示例#1
0
        public async Task <int> AddAsync(ContaCorrente.Model.AccountTransaction accountTransaction)
        {
            Account accountToUpdate = await Uow.Accounts.FindAsync(a => a.Id == accountTransaction.AccountId);

            if (accountToUpdate == null)
            {
                throw new ArgumentNullException("Account");
            }

            try
            {
                accountToUpdate.CurrentBalance = accountToUpdate.CurrentBalance + accountTransaction.TransactionValue;
                Uow.Accounts.Detach(accountToUpdate);
                var accountUpdated = await Uow.Accounts.UpdateAsync(accountToUpdate);

                var newAccountTransaction = await Uow.AccountTransactions.AddAsync(accountTransaction);

                this.Uow.Commit();
                return(newAccountTransaction);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#2
0
 public async Task <int> UpdateAsync(ContaCorrente.Model.AccountTransaction accountTransaction)
 {
     throw new Exception("Not implemented");
 }