public ActionResult Transfer() { IBusinessAccount iba = GenericFactory<BusinessLayer, IBusinessAccount>.CreateInstance(); String UserName = System.Web.HttpContext.Current.User.Identity.Name; string chkAcctNum = iba.GetChkAcctNum(UserName); string savAcctNum = chkAcctNum + "1"; CheckingAccount ca = new CheckingAccount(); ca.CheckingAccountNumber = chkAcctNum; ca.Balance = iba.GetCheckingBalance(chkAcctNum); SavingAccount sa = new SavingAccount(); sa.SavingAccountNumber = savAcctNum; sa.Balance = iba.GetSavingBalance(savAcctNum); ViewData["CheckingAccount"] = ca; ViewData["SavingAccount"] = sa; return View(new CheckingAccount()); }
public ViewResult Transfer(CheckingAccount ca) { IBusinessAccount iba = GenericFactory<BusinessLayer, IBusinessAccount>.CreateInstance(); try { string chkAcctNum = ca.CheckingAccountNumber; string savAcctNum = chkAcctNum + "1"; if (iba.TransferFromChkgToSav(chkAcctNum, savAcctNum, ca.Balance)) { ViewBag.msg = "Transfer successful.."; ca.Balance = iba.GetCheckingBalance(chkAcctNum); SavingAccount sa = new SavingAccount(); sa.SavingAccountNumber = savAcctNum; sa.Balance = iba.GetSavingBalance(savAcctNum); ViewData["CheckingAccount"] = ca; ViewData["SavingAccount"] = sa; } } catch (Exception ex) { ViewBag.msg = ex.Message; } return View(ca); }