예제 #1
0
        public CurrentConditions GetCurrentConditions(string zipCode)
        {
            WeatherUndergroundClient  wuClient = new WeatherUndergroundClient();
            CurrentConditionsResponse response = wuClient.GetCurrentConditions(zipCode);

            return(this.MapCurrentConditionsResponse(response));
        }
        public void TestGetCurrentConditionsByZipCode()
        {
            WeatherUndergroundClient client = new WeatherUndergroundClient();
            var currentConditions           = client.GetCurrentConditions("54911");

            Assert.NotNull(currentConditions);
        }
예제 #3
0
        /// <summary>
        /// Action that calls the Weather Underground library directly
        /// </summary>
        /// <param name="zipCode"></param>
        /// <returns></returns>
        public ActionResult Index(String zipCode = null)
        {
            if (String.IsNullOrWhiteSpace(zipCode))
            {
                zipCode = "53211";
            }


            WeatherUndergroundClient  weatherClient     = new WeatherUndergroundClient();
            CurrentConditionsResponse currentConditions = weatherClient.GetCurrentConditions(zipCode);

            HomeIndexModel model = new HomeIndexModel()
            {
                WeatherData = currentConditions
            };

            return(View(model));
        }