예제 #1
0
        public EnrollmentResultQueryList Handle(EnrollmentInputListByStudent command)
        {
            var result = new EnrollmentResultQueryList();

            result.Enrollment = _EREP.GetByStudent(command.StudentId);

            return(result);
        }
예제 #2
0
        public void ShouldGetByStudentAEnrollment()
        {
            var enrollmentsDB = _EREP.GetByStudent(enrollment.Student.Id);

            Assert.IsNotNull(enrollmentsDB);
            foreach (var enrollmentDB in enrollmentsDB)
            {
                Assert.AreEqual(enrollment.Status, EStatusEnrollment.PreEnrollment);
            }
        }
예제 #3
0
        public Enrollment DoEnrollmentAndRegistration(Student student, StudyPlan studyPlan)
        {
            var existentEnrollment = _enrollmentRepository.GetByStudent(student.Id);

            if (existentEnrollment != null)
            {
                throw new Exception("The Student is already Enrolled in another StudyPlan");
            }

            var existentEnrollments = _enrollmentRepository.GetByStudyPlan(studyPlan.Id);

            if (existentEnrollments.Any(x => x.Student.Id == student.Id))
            {
                throw new Exception("The Student is already Enrolled in this StudyPlan");
            }

            var newEnrollment = new Enrollment()
            {
                Id = new Guid(), Student = student, StudyPlan = studyPlan
            };

            return(_enrollmentRepository.Add(newEnrollment));
        }