コード例 #1
0
        public async Task <ActionResult <IEnumerable <WeatherForecast> > > Get()
        {
            _logger.LogInformation($"Begin GET/weatherforecast @ {DateTime.Now} FROM front-end application TO microservice");
            IEnumerable <WeatherForecast> result;

            try
            {
                result = await _weatherService.GetAllForecasts();
            }
            catch (HttpRequestException ex)
            {
                return(BadRequest(ex));
            }

            _logger.LogInformation($"End GET/weatherforecast @ {DateTime.Now} FROM front-end application TO microservice");

            return(Ok(result ?? new List <WeatherForecast>()));
        }