public TransactionResult Deposit(DepositTransaction depositTransaction) { // Add the deposit amount to the balance _balance += depositTransaction.GetAmount(); // Add the transaction to the list _transactionHistory.Add(depositTransaction); return TransactionResult.Success; }
public void CustomerDeposit(Customer name) { // Get the destination account Console.Write("\n Select account (1 - to Checkings Account, 2 - to Savings Account): "); var selection = Convert.ToInt32(Console.ReadLine()); var destinationAccount = selection == 1 ? (Account) name.GetCheckingsAccount() : (Account) name.GetSavingsAccount(); // Get the deposit amount Console.Write("\n Enter Amount: "); var depositAmount = Convert.ToDouble((Console.ReadLine())); // Create a new transaction with the deposit info Transaction depositTransaction = new DepositTransaction(destinationAccount, depositAmount); // Deposit the money into the account depositTransaction.FinalizeTransaction(); Console.WriteLine("\n\tDeposit Completed"); }