public ActionResult Create(DeptWithInsListViewModel dept) { try { // TODO: Add insert logic here // dept.Department.InstrutorId = dept.InsList.SelectedInstructorId; _departmentService.AddOrUpdateDepartment(dept.Department); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Department/Create //public ActionResult Create() { // return View(); //} public ActionResult Create() { // prepare the instructorlist for view display InstructorSelectList inslist = new InstructorSelectList() { _instructors = _instructorService.GetAllInstructors() }; DeptWithInsListViewModel depwithInsList = new DeptWithInsListViewModel() { InsList = inslist }; return(View(depwithInsList)); }