public CustomerDTO DepositAction([FromBody] DepositOrWithdrawDTO deposit) { var customer = _bank.Login(deposit.Credential); foreach (IAccount account in customer.GetAccounts()) { if (account.Number == deposit.AccountId) { account.deposit(deposit.Amount); break; } } return(new CustomerDTO(customer)); }
public CustomerDTO Withdraw([FromBody] DepositOrWithdrawDTO withdraw) { var customer = _bank.Login(withdraw.Credential); foreach (IAccount account in customer.GetAccounts()) { if (account.Number == withdraw.AccountId) { account.withdraw(withdraw.Amount); break; } } return(new CustomerDTO(customer)); }