public virtual void AddCourse(string courseTitle, DateTime startDate)
 {
     CourseData course = new CourseData {
         Title = courseTitle,
         StartDate = startDate
     };
     courseService.AddCourse(course);
 }
 public virtual void AddCourse(string courseTitle, DateTime startDate, int maxEnrollmentCount)
 {
     CourseData course = new CourseData {
         Title = courseTitle,
         StartDate = startDate,
         MaxEnrollmentCount = maxEnrollmentCount
     };
     courseService.AddCourse(course);
 }
 public void AddCourse(CourseData courseData)
 {
     using (KaplanTestPrepEntities con = new KaplanTestPrepEntities()) {
         var course = new Course {
             Title = courseData.Title,
             StartDate = courseData.StartDate,
             MaxEnrollmentCount = courseData.MaxEnrollmentCount
         };
         con.Courses.Add(course);
         con.SaveChanges();
     }
 }
        public bool UpdateCourse(CourseData courseData)
        {
            using (KaplanTestPrepEntities con = new KaplanTestPrepEntities()) {
                var course = con.Courses.Where(x => x.CourseId == courseData.CourseId).FirstOrDefault();
                if (course != null) {
                    course.Title = courseData.Title;
                    course.StartDate = courseData.StartDate;
                    course.MaxEnrollmentCount = courseData.MaxEnrollmentCount;

                    con.SaveChanges();
                    return true;
                }
            }
            return false;
        }