WIP: Item counts

This commit is contained in:
TheXamlGuy
2024-06-11 22:32:14 +01:00
parent 0fecdef1fe
commit ec7d6611a1
28 changed files with 205 additions and 74 deletions
+5 -8
View File
@@ -12,15 +12,12 @@ public class UpdateItemStateHandler(IDbContextFactory<WalletContext> dbContextFa
{
if (args.Value is (Guid id, int state))
{
await Task.Run(async () =>
using WalletContext context = await dbContextFactory.CreateDbContextAsync(cancellationToken);
if (await context.FindAsync<ItemEntry>(id) is ItemEntry result)
{
using WalletContext context = await dbContextFactory.CreateDbContextAsync(cancellationToken);
if (await context.FindAsync<ItemEntry>(id) is ItemEntry result)
{
result.State = state;
await context.SaveChangesAsync();
}
}, cancellationToken);
result.State = state;
await context.SaveChangesAsync(cancellationToken);
}
}
return false;