public IEnumerable <Weather> GetWeathers(int cityId) { var jSONData = new WeatherbitController(); var forecast = jSONData.GetJSONInfo(cityId); return(forecast.Data); }
static void weatherbitCurrentAPI() { Out output = new Out(); WeatherbitController weatherbitController = new WeatherbitController(); output.outputToConsole("***** Weatherbit Current Weather *****"); string cityName = "Valletta"; output.outputToConsole($"Current temperature for {cityName}: {weatherbitController.getCurrentTemperature(cityName, EndpointType.CURRENT)} "); }
static void weatherbitForecastAPI() { Out output = new Out(); WeatherbitController weatherbitController = new WeatherbitController(); output.outputToConsole("***** Weatherbit Forecast *****"); string cityName = "Valletta"; foreach (ApiData forecast in weatherbitController.getForecastList(cityName, EndpointType.FORECAST, 5).data) { output.outputToConsole($"Location: {cityName}, Date: {forecast.datetime}, Temp: {forecast.temp}"); } }
private static void WeatherbitAPI() { string cityName = "Valletta"; WeatherbitController weatherbitController = new WeatherbitController(); Console.WriteLine("**** Weatherbit ****"); Console.WriteLine("**** Current Weather API ****"); Console.WriteLine($"Current Temperature for {cityName}: {weatherbitController.getCurrentWeather(cityName)}"); /**** FORECAST****/ Console.WriteLine("***** Forecast API *****"); Console.WriteLine($"Forecast for {cityName}: "); foreach (WeatherbitForecast forecast in weatherbitController.getForecast(cityName)) { Console.WriteLine($"{forecast.getDateTime().ToString()} Minimum: {forecast.getMinimum()} Maximum: {forecast.getMaximum()}"); } }