예제 #1
0
        public async Task <Enrollment> UpdateEnrollment(Enrollment enrollment, EnrollmentInputParameters inputParameters,
                                                        long enrollmentId, CancellationToken cancellationToken)
        {
            var dataEnrollment = await _context.GetEnrollmentById(enrollmentId, cancellationToken);

            if (dataEnrollment.StudentId != inputParameters.StudentId)
            {
                throw new ArgumentException("Student Ids don't match.");
            }
            dataEnrollment.EnrollmentStatus = (int)enrollment.EnrollmentStatusId;

            var updatedEnrollment = await _context.UpdateEnrollmentStatus(dataEnrollment, cancellationToken);

            var updatedApiEnrollment = EnrollmentConverter.EntityToApiModel(updatedEnrollment);

            return(updatedApiEnrollment);
        }