Пример #1
0
        public async Task <ActionResult <EnrolleeAdjudicationDocument> > CreateEnrolleeAdjudicationDocument(int enrolleeId, [FromQuery] Guid documentGuid)
        {
            if (!await _enrolleeService.EnrolleeExistsAsync(enrolleeId))
            {
                return(NotFound(ApiResponse.Message($"Enrollee not found with id {enrolleeId}")));
            }
            var admin = await _adminService.GetAdminAsync(User.GetPrimeUserId());

            var document = await _enrolleeService.AddEnrolleeAdjudicationDocumentAsync(enrolleeId, documentGuid, admin.Id);

            if (document == null)
            {
                ModelState.AddModelError("documentGuid", "Enrollee Adjudication Document could not be created; network error or upload is already submitted");
                return(BadRequest(ApiResponse.BadRequest(ModelState)));
            }

            return(Ok(ApiResponse.Result(document)));
        }