// GET: Department public ActionResult Index() { // Ensures logged in if (Session["loggedInState"] == null) { return(Redirect("/403.html")); } // Checks if logged in bool state = (bool)Session["loggedInState"]; if (state == true) { // Establishes a department model DepartmentModel departmentModel = new DepartmentModel(); // Holds the new department Department newDepartment = new Department(); // Stored details for the department newDepartment.Title = Request.Form[1]; newDepartment.Head = int.Parse(Request.Form[2]); newDepartment.Address = int.Parse(Request.Form[3]); // Commences save to database departmentModel.CreateNewDepartment(newDepartment); // Return created department to view return(View(newDepartment)); } else { // If not logged in return(Redirect("/login.html")); } }