/// <summary> /// kicks off withdrawal workflow /// and prints balance after withdrawal to console /// </summary> /// <returns>success/failure</returns> public bool withdraw() { bool validAccount = false; do { Console.WriteLine("Please enter the account number for the account in which you'd like to withdraw money: "); var input = Console.ReadLine(); int accountNumber = Utility.tryParse(input, 0, MAX_ACCOUNT_NUMBER); Tuple <int, decimal> accountInfo = _bankAccountBiz.checkBalance(); //account number, balance if (accountInfo.Item1 == accountNumber) { validAccount = true; bool validAmount = false; do { Console.WriteLine("Please enter the amount you'd like to withdraw: "); input = Console.ReadLine(); decimal amount = Utility.tryParseDecimal(input, 0, accountInfo.Item2); if (amount > 0) { validAmount = true; Tuple <int, decimal> account = _bankAccountBiz.withdraw(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); }
public ActionResult <Tuple <int, decimal> > Balance(bool userCheck, int userId) { _userBiz.setUser(userId); return(_bankAccountBiz.checkBalance(userCheck)); }