public IActionResult AddSection(Section section) { if (!ModelState.IsValid) { ViewBag.Department = _services.GetDepartment(section.DepartmentId); return(View(section)); } if (section == null) { return(BadRequest()); } _services.CreateSection(section); _services.Save(); return(RedirectToAction("DepartmentList")); }