public ActionResult Edit([Bind(Include = "Product, LoanDecision, LoanType, LoanGenerationStatus, LoanStatus")] Loan loan) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { LoanServices.Update(CurrentUser.Id, loan, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.LoanDecisionList = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber", loan.LoanDecision); ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name", loan.LoanGenerationStatus); ViewBag.LoanStatusList = new SelectList(LoanStatusServices.List(db), "Id", "Name", loan.LoanStatus); ViewBag.LoanTypeList = new SelectList(LoanTypeServices.List(db), "ProductType", "Name", loan.LoanType); ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes", loan.Product); return(View(loan)); }
public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.LoanDecisionList = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber"); ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name"); ViewBag.LoanStatusList = new SelectList(LoanStatusServices.List(db), "Id", "Name"); ViewBag.LoanTypeList = new SelectList(LoanTypeServices.List(db), "ProductType", "Name"); ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes"); return(View()); }
// GET: Loan/Edit/5 public ActionResult Edit(Nullable <int> product) { Db db = new Db(DbServices.ConnectionString); if (product == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Loan loan = LoanServices.Get(product.Value, db); if (loan == null) { return(HttpNotFound()); } ViewBag.LoanDecisionList = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber", loan.LoanDecision); ViewBag.LoanGenerationStatusList = new SelectList(LoanGenerationStatusServices.List(db), "Id", "Name", loan.LoanGenerationStatus); ViewBag.LoanStatusList = new SelectList(LoanStatusServices.List(db), "Id", "Name", loan.LoanStatus); ViewBag.LoanTypeList = new SelectList(LoanTypeServices.List(db), "ProductType", "Name", loan.LoanType); ViewBag.ProductList = new SelectList(ProductServices.List(db), "Id", "Notes", loan.Product); return(View(loan)); }