Added Reset All Equipped Builds Button

This commit is contained in:
Sarah Faey 2023-11-30 17:17:40 +01:00
parent 0ac8fec909
commit 7de720cab3
2 changed files with 28 additions and 1 deletions

View file

@ -51,5 +51,16 @@ namespace Lieb.Data
using var context = _contextFactory.CreateDbContext();
return context.GuildWars2Builds.FirstOrDefault(b => b.GuildWars2BuildId == buildId);
}
public async Task ResetAllEquipped()
{
using var context = _contextFactory.CreateDbContext();
List<Equipped> buildsToRemove = context.Equipped.ToList();
if (buildsToRemove.Count > 0)
{
context.Equipped.RemoveRange(buildsToRemove);
await context.SaveChangesAsync();
}
}
}
}