/// <summary> /// Deactivates a teacher profile of the given ID and redirects to the same page. /// </summary> /// <param name="id">Stores id.</param> /// <returns></returns> public ActionResult DeleteTeacher(int id) { if (Session["adminId"] == null) { return(RedirectToAction("Index", "Login")); } _teacherBll.DeleteTeacher(id); return(RedirectToAction("Teachers")); }
public ActionResult DeleteTeacher(Teacher teacher) { teacher.Id = (int)Session["teacherId"]; if (!_teacherBll.IsPasswordValid(teacher)) { ViewData["Message"] = "Error"; return(View("DeactivateTeacher")); } _teacherBll.DeleteTeacher(teacher.Id); return(RedirectToAction("LogOut", "Login")); }