public ActionResult Create(Experience experience) { if (ModelState.IsValid) { db.Experiences.Add(experience); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProfessorID = new SelectList(db.Professors, "ProfessorID", "FirstName", experience.ProfessorID); return View(experience); }
public ActionResult Edit(Experience experience) { if (ModelState.IsValid) { db.Entry(experience).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.ProfessorID = new SelectList(db.Professors, "ProfessorID", "FirstName", experience.ProfessorID); return View(experience); }