Пример #1
0
        public Course TryAddCourse(CourseContract courseContract, out string message)
        {
            if (!Utilities.IsValidCourseContract(courseContract, out message))
            {
                return(null);
            }

            try
            {
                if (_coursesRepository.GetCourseByName(courseContract.Name) != null)
                {
                    message = "Course with the same name is already exist";
                    return(null);
                }

                var course = new Course(courseContract);
                return(_coursesRepository.AddCourse(course));
            }
            catch (DALException e)
            {
                // LOG
                throw new BLException("There was a problem adding new student", e);
            }
        }