Example #1
0
        public async Task <ActionResult <AdjudicatorNote> > CreateEnrolmentReference(int enrolleeId)
        {
            if (!await _enrolleeService.EnrolleeExistsAsync(enrolleeId))
            {
                return(NotFound(ApiResponse.Message($"Enrollee not found with id {enrolleeId}")));
            }
            var enrollee = await _enrolleeService.GetEnrolleeAsync(enrolleeId);

            var admin = await _adminService.GetAdminForUserIdAsync(User.GetPrimeUserId());

            var createdEnrolmentStatusReference = await _enrolleeService.CreateEnrolmentStatusReferenceAsync(enrollee.CurrentStatus.Id, admin.Id);

            return(CreatedAtAction(
                       nameof(CreateEnrolmentReference),
                       new { enrolleeId = enrolleeId },
                       ApiResponse.Result(createdEnrolmentStatusReference)
                       ));
        }