Beispiel #1
0
 public Course Parse(CourseModel model)
 {
     return(new Course()
     {
         Name = model.Name,
         Description = model.Description,
         Duration = model.Duration,
         CourseTutor = _repo.GetTutor(model.Tutor.Id),
         CourseSubject = _repo.GetSubject(model.Subject.Id)
     });
 }
Beispiel #2
0
 public Course Parse(CourseModel model)
 {
     try
     {
         var course = new Course()
         {
             Name          = model.Name,
             Description   = model.Description,
             Duration      = model.Duration,
             CourseSubject = _repo.GetSubject(model.Subject.Id),
             CourseTutor   = _repo.GetTutor(model.Tutor.Id)
         };
         return(course);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Beispiel #3
0
        public Course ParseFromCourseModel(CourseModel courseModel)
        {
            try {
                var course = new Course
                {
                    Name          = courseModel.Name,
                    Duration      = courseModel.Duration,
                    Description   = courseModel.Description,
                    CourseSubject = repository.GetSubject(courseModel.Subject.Id),
                    CourseTutor   = repository.GetTutor(courseModel.Tutor.Id)
                };

                return(course);
            }
            catch (Exception)
            {
                return(null);
            }
        }