public ActionResult Create(Department department) { if (ModelState.IsValid) { db.Departments.Add(department); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.InstructorID = new SelectList(db.Instructors, "InstructorID", "FirstMidName", department.InstructorID); return View(department); }
public ActionResult Edit(Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.InstructorID = new SelectList(db.Instructors, "InstructorID", "FirstMidName", department.InstructorID); return View(department); }