Mass rename project for rebranding
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Wallet.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Threading;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Wallet;
|
||||
|
||||
public class UnarchiveItemHandler(IDecoratorService<Item<(Guid, string)>> decoratorService,
|
||||
IDbContextFactory<WalletContext> dbContextFactory) :
|
||||
INotificationHandler<UnarchiveEventArgs<Item>>
|
||||
{
|
||||
public async Task Handle(UnarchiveEventArgs<Item> args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (decoratorService.Service is Item<(Guid, string)> item)
|
||||
{
|
||||
(Guid id, string name) = item.Value;
|
||||
|
||||
using WalletContext context = await dbContextFactory.CreateDbContextAsync();
|
||||
if (await context.FindAsync<ItemEntry>(id) is ItemEntry result)
|
||||
{
|
||||
result.State = 0;
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user