예제 #1
0
        public async Task <IActionResult> Get(string city)
        {
            if (string.IsNullOrEmpty(city))
            {
                return(BadRequest());
            }
            var result = await client.GetCurrentWeatherAsync(city);

            if (result is null)
            {
                return(NotFound());
            }
            return(Ok(new WeatherForecast {
                Summary = result.weather[0].description,
                TemperatureC = (int)result.main.temp,
                Date = DateTimeOffset.FromUnixTimeSeconds(result.dt).DateTime
            }));
        }