Ejemplo n.º 1
0
 public ActionResult Create(Course course, int StudentId)
 {
     _db.Courses.Add(course);
     if (StudentId != 0)
     {
         _db.Enrollment.Add(new Enrollment()
         {
             StudentId = StudentId, CourseId = course.CourseId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 2
0
 public ActionResult Create(Student student)
 {
     _db.Students.Add(student);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }