Пример #1
0
        public Transaction TransferMoney(string accountNumber, string toAccountNumber, decimal amount)
        {
            //setting minimum balance to 1000
            decimal minimumBalance   = 1000;
            decimal availableBalance = transactionDataLayer.AvailableBalance(accountNumber);

            //checking amount left after transaferring should be greater then 1000
            if (availableBalance - amount < minimumBalance)
            {
                throw new InsufficientBalanceException("Insufficient Balance. The Minimum Balance in the amount should be 1000 after withdrawal");
            }

            //Checkig if the account in which money is to be transferred exists or not
            if (reportDataLayer.GetAccountbyAccountNumber(toAccountNumber) == null)
            {
                throw new AccountDoesNotExistException("You have Entered  account number that Doesnot exist");
            }

            return(transactionDataLayer.TransferMoney(accountNumber, toAccountNumber, amount));
        }
Пример #2
0
 public Account GetAccountbyAccountNumber(string accountNumber)
 {
     return(reportDataLayer.GetAccountbyAccountNumber(accountNumber));
 }