public ActionResult Edit(Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(student); }
public Enrollment EnrollStudent(Student student) { var enrollment = new Enrollment(); enrollment.Unit = this; enrollment.Student = student; Enrollments.Add(enrollment); student.Enrollments.Add(enrollment); return enrollment; }
public ActionResult Create(Student student) { if (ModelState.IsValid) { db.Students.Add(student); db.SaveChanges(); return RedirectToAction("Index"); } return View(student); }