Esempio n. 1
0
        public ActionResult GetWeather(int CityID, string API)
        {
            WeatherApiName oWeatherApiName = (WeatherApiName)Enum.Parse(typeof(WeatherApiName), API);

            oWeatherHelper = WeatherHelperFactory.GetWeatherHelper(oWeatherApiName);
            return(Json(oWeatherHelper.GetWeatherInformation(Server.MapPath(CITY_LIST_RELATIVE_PATH), CityID), JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public static WeatherHelper GetWeatherHelper(WeatherApiName Api)
        {
            WeatherHelper helper = null;

            if (Api == WeatherApiName.OpenWeather)
            {
                helper = new OpenWeatherHelper();
            }
            else if (Api == WeatherApiName.Apixu)
            {
                helper = new ApixuWeatherHelper();
            }

            return(helper);
        }