Beispiel #1
0
        public async Task <IActionResult> GetAllHearingsByCreatedBy(string createdBy)
        {
            _logger.LogDebug("GetAllHearingsByCreatedBy {createdBy}");

            try
            {
                var allHearingsResponse = await _testApiClient.GetAllHearingsAsync();

                _logger.LogDebug("Retrieved {count} hearings in total.", allHearingsResponse.Count);
                var hearings = (from hearing in allHearingsResponse where hearing.CreatedBy.ToLower().Equals(createdBy.ToLower()) select HearingResponseMapper.Map(hearing)).ToList();
                _logger.LogDebug("Filtered down to {count} hearings in total created by '{createdBy}'.", hearings.Count, createdBy);
                return(Ok(hearings));
            }
            catch (TestApiException e)
            {
                _logger.LogError(e, "Unable to fetch hearings with error '{message}'", e.Message);
                return(StatusCode(e.StatusCode, e.Response));
            }
        }