Beispiel #1
0
        public ActionResult WeatherMainView()
        {
            PopulateTheModel   obj   = new PopulateTheModel();
            CityWeatherDetails model = new CityWeatherDetails();

            obj.PopulateTheCityWeatherObject(ref model);
            return(PartialView(model));
        }
Beispiel #2
0
        public void PopulateTheCityWeatherObject(ref CityWeatherDetails objCity)
        {
            try
            {
                string WeatherInfo;
                GetWeatherDataFromAPI gt = new GetWeatherDataFromAPI();
                WeatherInfo = gt.GetWeatherDataFromWebAPI("Bangalore");

                objCity      = JsonConvert.DeserializeObject <Wrapper>(WeatherInfo).CityWeatherDetails;
                objCity.temp = (Convert.ToDouble(objCity.temp) - 273.15).ToString();
            }
            catch (Exception ex)
            {
            }
        }