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)); }