public ActionResult Create([Bind(Include = "Id, RefundableProduct, SubNumber, Employee, GuarantorStatus, Notes")] Guarantor guarantor) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { GuarantorServices.Insert(CurrentUser.Id, guarantor, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.GuarantorStatusList = new SelectList(GuarantorStatusServices.List(db), "Id", "Name"); ViewBag.RefundableProductList = new SelectList(RefundableProductServices.List(db), "Product", "Name"); return(View(guarantor)); }
public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.GuarantorStatusList = new SelectList(GuarantorStatusServices.List(db), "Id", "Name"); ViewBag.RefundableProductList = new SelectList(RefundableProductServices.List(db), "Product", "Name"); return(View()); }
// GET: GuarantorStatus/Delete/5 public ActionResult Delete(Nullable <byte> id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Db db = new Db(DbServices.ConnectionString); GuarantorStatus guarantorStatus = GuarantorStatusServices.Get(id.Value, db); if (guarantorStatus == null) { return(HttpNotFound()); } return(View(guarantorStatus)); }
public ActionResult DeleteConfirmed(byte id) { try { Db db = new Db(DbServices.ConnectionString); GuarantorStatusServices.Delete(CurrentUser.Id, id, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "DeleteConfirmed"); // return RedirectToAction("Index"); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } // return View(guarantorStatus); return(RedirectToAction("Index")); }
// GET: Guarantor/Edit/5 public ActionResult Edit(Nullable <int> id) { Db db = new Db(DbServices.ConnectionString); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Guarantor guarantor = GuarantorServices.Get(id.Value, db); if (guarantor == null) { return(HttpNotFound()); } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName", guarantor.Employee); ViewBag.GuarantorStatusList = new SelectList(GuarantorStatusServices.List(db), "Id", "Name", guarantor.GuarantorStatus); ViewBag.RefundableProductList = new SelectList(RefundableProductServices.List(db), "Product", "Name", guarantor.RefundableProduct); return(View(guarantor)); }
public ActionResult EditGuarantorWithStatement(int?id) { ViewBag.ModuleName = moduleName; ViewBag.Action = update; ViewBag.Update = update; ViewBag.Save = save; ViewBag.Back = back; Db db = new Db(DbServices.ConnectionString); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Guarantor guarantor = GuarantorServices.Get(id.Value, db); if (guarantor == null) { return(HttpNotFound()); } GuarantorStatement guarantorStatement = GuarantorStatementServices.Get(guarantor.Id, db); if (guarantorStatement == null) { return(HttpNotFound()); } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "Id_Name", guarantor.Employee); ViewBag.GuarantorStatusList = new SelectList(GuarantorStatusServices.List(db), "Id", "Name", guarantor.GuarantorStatus); ViewBag.ProductId = guarantor.RefundableProduct; GuarantorWithStatmentViewModel vm = new GuarantorWithStatmentViewModel(); vm.Guarantor = guarantor; vm.GuarantorStatement = guarantorStatement; return(PartialView(vm)); }
public ActionResult Create([Bind(Include = "Id, Name")] GuarantorStatus guarantorStatus) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { GuarantorStatusServices.Insert(CurrentUser.Id, guarantorStatus, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } return(View(guarantorStatus)); }