예제 #1
0
        public bool Withdrawal(string bankId, string value)
        {
            int    account = 0;
            double ammount = 0;

            if (!int.TryParse(bankId, out account))
            {
                Console.WriteLine("Please, input a valid account number");
                return(false);
            }

            if (!double.TryParse(value, out ammount))
            {
                Console.WriteLine("Please, input a valid ammount");
                return(false);
            }

            if (!CheckBalance(account, ammount))
            {
                double?balance = _bankAccountRepository.CheckBalance(account);
                Console.WriteLine("Please verify if the ammount and account are correct.");
                return(false);
            }

            return(_bankAccountRepository.Withdrawal(account, ammount));
        }