public ActionResult Edit(Student student, int CourseId) { if (CourseId != 0) { _db.CourseStudent.Add(new CourseStudent() { CourseId = CourseId, StudentId = student.StudentId }); } _db.Entry(student).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Course course) { _db.Entry(course).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }