Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public void Handle(ICommandContext context, FreezeWalletCommand command)
 {
     context.Get <Wallet>(command.AggregateRootId).Freeze();
 }