public async Task <IActionResult> GetBirdsDdlAsync() //BirderStatus filter) { try { if (_cache.TryGetValue(CacheEntries.BirdsSummaryList, out IEnumerable <BirdSummaryViewModel> birdsCache)) { return(Ok(birdsCache)); } else { var birds = await _birdRepository.GetBirdsDdlAsync(); if (birds is null) { _logger.LogWarning(LoggingEvents.GetListNotFound, "Birds list is null"); return(StatusCode(500, $"bird repository returned null")); } var viewModel = _mapper.Map <IEnumerable <Bird>, IEnumerable <BirdSummaryViewModel> >(birds); _cache.Set(CacheEntries.BirdsSummaryList, viewModel, TimeSpan.FromDays(1)); return(Ok(viewModel)); } } catch (Exception ex) { _logger.LogError(LoggingEvents.GetListNotFound, ex, "An error occurred getting the birds list"); return(StatusCode(500, "an unexpected error occurred")); } }