Beispiel #1
0
        public async Task <ActionResult> GetEnrollees([FromQuery] EnrolleeSearchOptions searchOptions)
        {
            if (User.HasAdminView())
            {
                var notifiedIds = await _enrolleeService.GetNotifiedEnrolleeIdsForAdminAsync(User);

                var enrollees = await _enrolleeService.GetEnrolleesAsync(searchOptions);

                var result = enrollees.Select(e => e.SetNotification(notifiedIds.Contains(e.Id)));
                return(Ok(ApiResponse.Result(result)));
            }
            else
            {
                var enrollee = await _enrolleeService.GetEnrolleeForUserIdAsync(User.GetPrimeUserId());

                return(Ok(ApiResponse.Result(enrollee == null ? Enumerable.Empty <Enrollee>() : new[] { enrollee })));
            }
        }