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"));
 }
Beispiel #2
0
 public ActionResult Create(Course course)
 {
     _db.Courses.Add(course);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }