public ActionResult DeleteConfirmed(int id) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { EmployeeLeaveCountHistory employeeLeaveCountHistory = db.EmployeeLeaveCountHistory.Find(id); db.EmployeeLeaveCountHistory.Remove(employeeLeaveCountHistory); db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult Edit([Bind(Include = "Id,EmployeeId,EarnLeaveDays,WithoutPayLeaveDays")] EmployeeLeaveCountHistory employeeLeaveCountHistory) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { if (ModelState.IsValid) { db.Entry(employeeLeaveCountHistory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } List <Employee> employee = db.Employee.Where(i => i.Status == true).ToList(); ViewBag.EmployeeId = new SelectList(employee, "Id", "Name"); return(View(employeeLeaveCountHistory)); } else { return(RedirectToAction("Login", "Account")); } }
// GET: EmployeeLeaveCountHistories/Details/5 public ActionResult Details(int?id) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EmployeeLeaveCountHistory employeeLeaveCountHistory = db.EmployeeLeaveCountHistory.Find(id); if (employeeLeaveCountHistory == null) { return(HttpNotFound()); } return(View(employeeLeaveCountHistory)); } else { return(RedirectToAction("Login", "Account")); } }
// GET: EmployeeLeaveCountHistories/Edit/5 public ActionResult Edit(int?id) { if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EmployeeLeaveCountHistory employeeLeaveCountHistory = db.EmployeeLeaveCountHistory.Find(id); if (employeeLeaveCountHistory == null) { return(HttpNotFound()); } List <Employee> employee = db.Employee.Where(i => i.Status == true).ToList(); ViewBag.EmployeeId = new SelectList(employee, "Id", "Name"); return(View(employeeLeaveCountHistory)); } else { return(RedirectToAction("Login", "Account")); } }