Example #1
0
        public async Task <ActionResult <EnrolleeNotification> > CreateEnrolleeNotification(int enrolleeId, int adjudicatorNoteId, FromBodyData <int> assigneeId)
        {
            if (!await _enrolleeService.EnrolleeExistsAsync(enrolleeId))
            {
                return(NotFound(ApiResponse.Message($"Enrollee not found with id {enrolleeId}")));
            }
            var note = await _enrolleeService.GetEnrolleeAdjudicatorNoteAsync(enrolleeId, adjudicatorNoteId);

            if (note == null)
            {
                return(NotFound(ApiResponse.Message($"Enrollee note not found with id {adjudicatorNoteId}")));
            }

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

            var notification = await _enrolleeService.CreateEnrolleeNotificationAsync(note.Id, admin.Id, assigneeId);

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