public async Task <ActionResult <Wallet> > FreezeWallet(FreezeWalletCommand command) { var wallet = await _context.Wallets.FindAsync(command.WalletId); if (wallet == null) { return(null); } wallet.Frozen = true; _context.Entry(wallet).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WalletExists(command.WalletId)) { return(null); } else { throw; } } return(wallet); }
public void Handle(ICommandContext context, FreezeWalletCommand command) { context.Get <Wallet>(command.AggregateRootId).Freeze(); }