public EnrollmentResultQueryList Handle(EnrollmentInputListByStudent command) { var result = new EnrollmentResultQueryList(); result.Enrollment = _EREP.GetByStudent(command.StudentId); return(result); }
public void ShouldGetByStudentAEnrollment() { var enrollmentsDB = _EREP.GetByStudent(enrollment.Student.Id); Assert.IsNotNull(enrollmentsDB); foreach (var enrollmentDB in enrollmentsDB) { Assert.AreEqual(enrollment.Status, EStatusEnrollment.PreEnrollment); } }
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)); }