public ActionResult Edit([Bind(Include = "StudentID,LastName,FirstName,EnrollmentDate")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Edit([Bind(Include = "EnrollmentID,Grade,CourseID,StudentID")] Enrollment enrollment) { if (ModelState.IsValid) { db.Entry(enrollment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "Title", enrollment.CourseID); ViewBag.StudentID = new SelectList(db.Students, "StudentID", "LastName", enrollment.StudentID); return(View(enrollment)); }