public static IEnumerable <WeatherForecast> ToWeatherForecast(WeatherForecastApi weatherForecast) { return(weatherForecast.List.Select(el => new WeatherForecast { Date = DateTime.Parse(el.DateText), WindSpeed = el.Wind.Speed, WindDirection = el.Wind.Deg, Visibility = el.Visibility, Cloudiness = el.Clouds.All, Temperature = el.Main.Temp, TemperatureFeels = el.Main.FeelsLike, MaximalTemperature = el.Main.TempMax, MinimalTemperature = el.Main.TempMin, Pressure = el.Main.Preassure, Humidity = el.Main.Humidity, Weather = el.Weather.Select(w => new WeatherProperties { WeatherDescription = w.Description, WeatherIcon = "openweathermap.org/img/w/" + w.Icon + ".png", WeatherName = w.Main }).ToList() })); }
static void Main(string[] args) { // TODO: Invocar API a traves de Client // BasePath: http://localhost:5000 IWeatherForecastApi api = new WeatherForecastApi("http://localhost:5000"); var response = api.WeatherForecastGet(); foreach (var item in response) { Console.WriteLine($"{item.Date} {item.TemperatureC} {item.TemperatureF} {item.Summary}"); } }
public WeatherForecastApiTests() { instance = new WeatherForecastApi(); }