public ActionResult Create(Student student) { if (ModelState.IsValid) { context.Students.Add(student); context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossibleCourses = context.Courses; return View(student); }
public ActionResult Edit(Student student) { if (ModelState.IsValid) { context.Entry(student).State = EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PossibleCourses = context.Courses; return View(student); }