static void DoTransfer(Bank bank) { Console.WriteLine("Transfer from:"); Account from = FindAccount(bank); Console.WriteLine("Transfer to:"); Account to = FindAccount(bank); if (from != null && to != null) { decimal amount = ReadDecimal("Enter the amount"); TransferTransaction transfer = new TransferTransaction(from, to, amount); bank.Execute(transfer); transfer.Print(); } }
/// <summary> /// Attempts to transfer funds between accounts /// </summary> /// <param name="bank">The bank holding the accounts /// to transfer between</param> static void DoTransfer(Bank bank) { Console.WriteLine("Transfer from:"); Account from = FindAccount(bank); Console.WriteLine("Transfer to:"); Account to = FindAccount(bank); if (from != null && to != null) { decimal amount = ReadDecimal("Enter the amount"); try { TransferTransaction transfer = new TransferTransaction(from, to, amount); bank.Execute(transfer); transfer.Print(); } catch (Exception) { // Currently this is handled in the TransferTransaction. This will be changed } } }