Example #1
0
        public void GetWorldTemperaturesWithMapper(WeatherInfoViewModel viewModel)
        {
            Weather_Request request = new Weather_Request()
            {
                City = viewModel.CityFilter
            };

            CallService <WeatherInfoViewModel, Weather_Request, Weather_Response, WeatherServiceClient>(viewModel, (c, req) => c.WeatherInfo(req));
        }
Example #2
0
        public Weather_Response WeatherInfo(Weather_Request request)
        {
            Weather_Response response     = new Weather_Response();
            string           htmlContents = weatherReader.Download(configManager.GetAppSetting("WorldWeatherUrl") + "weather/");

            response.locations = htmlScraper.GetCities(htmlContents);
            request.City       = request.City ?? string.Empty;
            response.locations = response.locations.Where(l => l.City.Contains(request.City)).ToList();
            return(response);
        }
Example #3
0
        public WeatherInfoViewModel GetWorldTemperatures(WeatherInfoViewModel viewModel)
        {
            var weatherInfoViewModel = new WeatherInfoViewModel();
            var request = new Weather_Request()
            {
                City = viewModel.CityFilter
            };
            var worldTemperaturesResponse = GetResponseFromServiceCall <Weather_Request, Weather_Response, WeatherServiceClient>(request, (c, req) => c.GetWorldTemperaturesSoap(req));

            var mapper = new WeatherInfoMapper();

            mapper.Map(worldTemperaturesResponse, weatherInfoViewModel);

            //var dummyRequest = new Dummy_Request();
            //var dummyResponse = GetResponseFromServiceCall<Dummy_Request, Dummy_Response, DummyServiceClient>(dummyRequest, (c, req) => c.GetData(dummyRequest));

            return(weatherInfoViewModel);
        }