public void ChangeCourse(Course course) { // Remove from existing course if (Course != null) Course.RemoveUnit(this); // Add to new course course.AddUnit(this); }
public ActionResult Edit(Course course) { if (ModelState.IsValid) { db.Entry(course).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(course); }
public ActionResult Create(Course course) { if (ModelState.IsValid) { db.Courses.Add(course); db.SaveChanges(); return RedirectToAction("Index"); } return View(course); }