// Controller for modification of a department public ActionResult EditDepartment() { // Null handling if (Session["loggedInState"] == null) { return(Redirect("/403.html")); } // Checks if logged in bool state = (bool)Session["loggedInState"]; if (state == true) { // Creates an department placeholder var d = new Department(); // Setup address edit d.Id = int.Parse(Request.Form["id"]); d.Title = Request.Form["title"]; d.Head = int.Parse(Request.Form["head"]); d.Address = int.Parse(Request.Form["address"]); // Establish department model var dm = new DepartmentModel(); // Conduct edit dm.EditDepartment(d); // TODO: Redirect to appropriate page (Add address?) // Passes back to the view return(View()); } else { // If not logged in return(Redirect("/login.html")); } }
public ActionResult Edit(DepartmentModel model) { model.EditDepartment(model.Id); return(RedirectToAction("Index")); }