示例#1
0
        public bool MakeWithdrawal(Account account, decimal amountToWithdraw)
        {
            var isSuccessful = false;

            var repo = AccountFactory.CreateAccountRepository();

            var source = repo.GetAccountByNumber(account.AccountNumber);
            if (source != null)
            {
                if (source.Balance >= amountToWithdraw)
                {
                    isSuccessful = repo.Withdrawal(source, amountToWithdraw);

                    if (isSuccessful)
                    {
                        response.Success = true;
                        response.AccountInfo = source;
                    }
                    else
                    {
                        response.Success = false;
                        response.Message = "Withdraw failed";
                    }
                }
                else
                {
                    response.Success = false;
                    response.Message = "Not";
                }
                }
            }