예제 #1
0
        public bool TryToEnroll(int studentId, int courseId, out string errorMessage)
        {
            errorMessage = string.Empty;
            var isAny = _courseRepository.IsAnyEntrollment(studentId, courseId);

            if (isAny)
            {
                errorMessage = "You are already enrolled in this course";
                return(false);
            }
            _courseRepository.CreateEnrollment(studentId, courseId);
            return(true);
        }