Beispiel #1
0
 public bool SaveCourse(Course course)
 {
     try
     {
         if (_courseServices.GetCourseById(course.Id) == null)
         {
             var courseId = _courseServices.CreateCourse(course.Name, course.NaturalIdentifier, course.EctsCredits).Id;
             _courseServices.UpdateLecturers(courseId, course.LecturersInCharge);
             _courseServices.UpdateStudents(courseId, course.StudentsEnrolled);
         }
         else
         {
             _courseServices.UpdateCourse(course.Id, course.Name, course.NaturalIdentifier, course.EctsCredits);
             _courseServices.UpdateLecturers(course.Id, course.LecturersInCharge);
             _courseServices.UpdateStudents(course.Id, course.StudentsEnrolled);
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }