/// <summary>
        /// kicks off deposit workflow and
        /// prints balance after deposit to console
        /// </summary>
        /// <returns>success/failures</returns>
        public bool deposit()
        {
            bool validAccount = false;

            do
            {
                Console.WriteLine("Please enter the account number for the account in which you'd like to deposit money: ");
                var input = Console.ReadLine();

                int accountNumber = Utility.tryParse(input, 0, MAX_ACCOUNT_NUMBER);

                Tuple <int, decimal> accountInfo = _bankAccountBiz.checkBalance();

                if (accountInfo.Item1 == accountNumber)
                {
                    validAccount = true;
                    bool validAmount = false;

                    do
                    {
                        Console.WriteLine("Please enter the amount you'd like to deposit: ");
                        Console.WriteLine("Max deposit amount: $10,000");
                        input = Console.ReadLine();
                        decimal amount = Utility.tryParseDecimal(input, 0, 10000);

                        if (amount > 0)
                        {
                            validAmount = true;
                            Tuple <int, decimal> account = _bankAccountBiz.deposit(amount, accountNumber); //account number, balance
                        }
                        else
                        {
                            Console.WriteLine("Sorry, that amount is not valid.");
                            Utility.printAccountInfo(accountInfo);
                        }
                    } while (!validAmount);
                }
                else
                {
                    Console.WriteLine("Sorry. That account number is not valid.");
                }
            } while (!validAccount);

            return(true);
        }
Example #2
0
 public ActionResult <Tuple <int, decimal> > Deposit([FromBody] AccountInfo depositInfo)
 {
     _userBiz.setUser(depositInfo.userId);
     return(_bankAccountBiz.deposit(depositInfo.amount, depositInfo.accountNumber));
 }