public static bool MakeTransfer(BankAccount senderAccount, BankAccount receiverAccount, decimal transferAmount)
        {
            Console.WriteLine($"Started transfer money: {transferAmount}");

            if (senderAccount == receiverAccount)
            {
                Console.WriteLine("The account number error. Canceled operation.");
            }

            if (senderAccount.WithdrawMoney(transferAmount))
            {
                receiverAccount.DepositMoney(transferAmount);
                return(true);
            }

            return(false);
        }
示例#2
0
 private void Initialize()
 {
     _accountFirst.DepositMoney(1000);
     _accountSecond.DepositMoney(1000);
 }