private async Task <AccountSummary> GetAccountSummary(int accountNumber) { var accountSummaryEntity = await _accountSummaryRepository .Read(accountNumber); return(_mapper.Map <AccountSummary>(accountSummaryEntity)); }
private async Task <TransactionResult> CreateTransactionAndUpdateSummary(AccountTransaction accountTransaction, AccountSummary accountSummary) { var accountTransactionEntity = _mapper.Map <AccountTransactionEntity>(accountTransaction); var accountSummaryEntity = _mapper.Map <AccountSummaryEntity>(accountSummary); await _accountTransactionRepository.Create(accountTransactionEntity, accountSummaryEntity); var currentSummary = await _accountSummaryRepository.Read(accountTransaction.AccountNumber); var result = _mapper.Map <TransactionResult>(accountTransactionEntity); result.Balance = new Money(currentSummary.Balance, currentSummary.Currency.TryParseEnum <Currency>()); return(result); }