// GET:PositionEmployees/Delete/5 public ActionResult Delete(int id, bool?saveChangesError) { if (saveChangesError.GetValueOrDefault()) { ViewBag.ErrorMessage = "Unable to save changes. Try again, and if the problem persists see your system administrator."; } return(View(PositionEmployeeMethods.GetItem(id))); }
// GET: PositionEmployees/Edit/5 public ActionResult Edit(int id) { PositionEmployee item = PositionEmployeeMethods.GetItem(id); if (item == null) { return(HttpNotFound()); } return(View(item)); }
public ActionResult DeleteConfirmed(int id) { try { PositionEmployeeMethods.DeleteItem(id); } catch (DataException) { return(RedirectToAction("Delete", new System.Web.Routing.RouteValueDictionary { { "id", id }, { "saveChangesError", true } })); } return(RedirectToAction("Index")); }
public ActionResult Edit(PositionEmployee item) { try { if (ModelState.IsValid) { PositionEmployeeMethods.ChangeItem(item); return(RedirectToAction("Index")); } } catch (DataException) { //Log the error (add a variable name after DataException) ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(item)); }
// GET: PositionEmployees public ActionResult Index() { return(View(PositionEmployeeMethods.Outpoot().ToList())); }