public ActionResult Create([Bind(Include = "Id, InstallmentDecreaseOrder, Employee, Department, DecreaseAmount, NewInstallmentAmount, Notes")] InstallmentDecrease installmentDecrease) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { InstallmentDecreaseServices.Insert(CurrentUser.Id, installmentDecrease, 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.InstallmentDecreaseOrderList = new SelectList(InstallmentDecreaseOrderServices.List(db), "Id", "CersNumber"); ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name"); return(View(installmentDecrease)); }
public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.InstallmentDecreaseOrderList = new SelectList(InstallmentDecreaseOrderServices.List(db), "Id", "CersNumber"); ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name"); return(View()); }
// GET: InstallmentDecreaseOrder/Delete/5 public ActionResult Delete(Nullable <int> id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Db db = new Db(DbServices.ConnectionString); InstallmentDecreaseOrder installmentDecreaseOrder = InstallmentDecreaseOrderServices.Get(id.Value, db); if (installmentDecreaseOrder == null) { return(HttpNotFound()); } return(View(installmentDecreaseOrder)); }
// GET: InstallmentDecrease/Edit/5 public ActionResult Edit(Nullable <int> id) { Db db = new Db(DbServices.ConnectionString); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InstallmentDecrease installmentDecrease = InstallmentDecreaseServices.Get(id.Value, db); if (installmentDecrease == null) { return(HttpNotFound()); } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName", installmentDecrease.Employee); ViewBag.InstallmentDecreaseOrderList = new SelectList(InstallmentDecreaseOrderServices.List(db), "Id", "CersNumber", installmentDecrease.InstallmentDecreaseOrder); ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name", installmentDecrease.Department); return(View(installmentDecrease)); }
public ActionResult DeleteConfirmed(int id) { try { Db db = new Db(DbServices.ConnectionString); InstallmentDecreaseOrderServices.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(installmentDecreaseOrder); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Id, Month, CersNumber, CersDate, Notes")] InstallmentDecreaseOrder installmentDecreaseOrder) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { InstallmentDecreaseOrderServices.Insert(CurrentUser.Id, installmentDecreaseOrder, 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(installmentDecreaseOrder)); }