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