public ActionResult Create(Student student, int CourseId)
 {
     _db.Students.Add(student);
     if (CourseId != 0)
     {
         _db.Enrollment.Add(new Enrollment()
         {
             CourseId = CourseId, StudentId = student.StudentId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(Course course)
 {
     _db.Courses.Add(course);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Esempio n. 3
0
 public ActionResult Create(Department department)
 {
     _db.Departments.Add(department);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }