public ActionResult DeleteConfirmed(int id) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { DisciplinaryAction disciplinaryAction = db.DisciplinaryAction.Find(id); db.DisciplinaryAction.Remove(disciplinaryAction); db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "Account")); } }
// GET: DisciplinaryActions/Details/5 public ActionResult Details(int?id) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DisciplinaryAction disciplinaryAction = db.DisciplinaryAction.Find(id); if (disciplinaryAction == null) { return(HttpNotFound()); } return(View(disciplinaryAction)); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult Edit([Bind(Include = "Id,EmployeeId,DisciplinaryActionTypeId,Date,Remarks")] DisciplinaryAction disciplinaryAction) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { if (ModelState.IsValid) { disciplinaryAction.Date = DateTime.Now; db.Entry(disciplinaryAction).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DisciplinaryActionTypeId = new SelectList(db.DisciplinaryActionTypes, "Id", "Name", disciplinaryAction.DisciplinaryActionTypeId); ViewBag.EmployeeId = new SelectList(db.Employee, "Id", "Name", disciplinaryAction.EmployeeId); return(View(disciplinaryAction)); } else { return(RedirectToAction("Login", "Account")); } }
// GET: DisciplinaryActions/Edit/5 public ActionResult Edit(int?id) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DisciplinaryAction disciplinaryAction = db.DisciplinaryAction.Find(id); if (disciplinaryAction == null) { return(HttpNotFound()); } ViewBag.DisciplinaryActionTypeId = new SelectList(db.DisciplinaryActionTypes, "Id", "Name", disciplinaryAction.DisciplinaryActionTypeId); ViewBag.EmployeeId = new SelectList(db.Employee, "Id", "Name", disciplinaryAction.EmployeeId); return(View(disciplinaryAction)); } else { return(RedirectToAction("Login", "Account")); } }