// GET: Banking
        public ActionResult ApplyLoan()
        {
            ApplyLoanModel   alm   = new ApplyLoanModel();
            UserInfo         ui    = CookieFacade.USERINFO;
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            alm.UserName = ui.Username;
            alm.Amount   = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            //alm.Status = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            ViewBag.Message = "";
            return(View(alm));
        }
        public ActionResult ApplyLoan(ApplyLoanModel alm)
        {
            int count = 0;
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;

            if (ui.Username == "mark")
            {
                ViewBag.Message = "Only customer is available to apply the loan ..";
            }
            try
            {
                if (ModelState.IsValid && ui.Username != "mark" && count == 0)
                {
                    if (count != 0)
                    {
                        ViewBag.Message = "You already applied the loan ..";
                    }
                    bool ret = ibank.ApplyLoan(ui.CheckingAcccountNumber, ui.SavingAccountNumber, alm.Amount, ui.Username);
                    if (ret == true)
                    {
                        ViewBag.Message = "Applied a loan successfully..";
                        ModelState.Clear();
                        // otherwise, textbox will display the old amount
                        alm.Amount = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            //alm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            return(View(alm));
        }