public async Task <IActionResult> GetAllInfoAsync()
        {
            _logger.LogInformation($"Starting method '{nameof(GetAllInfoAsync)}'.");

            try
            {
                var allInfo = await _infoDbService.GetAllAsync();

                var allInfoDto = MapToDtoEnumerable(allInfo);
                var response   = new ResponseWrapper(allInfoDto);
                _logger.LogInformation($"Finished method '{nameof(GetAllInfoAsync)}'.");
                return(Ok(response));
            }
            catch (InternalDbServiceException ex)
            {
                LogInternalDbServiceException(ex, _infoDbService.GetType());
                throw;
            }
            catch (Exception ex)
            {
                LogUnexpectedException(ex);
                throw;
            }
        }
Example #2
0
        private async Task <VisitInfo> GetRecentSightseeingInfoAsync(IVisitInfoDbService infoDbService)
        {
            var allInfo = await infoDbService.GetAllAsync();

            return(allInfo.OrderByDescending(x => x.UpdatedAt == DateTime.MinValue ? x.CreatedAt : x.UpdatedAt).First());
        }