Exemple #1
0
        public ActionResult Data(WeatherSearchModel model)
        {
            var weatherSearchCriteria = new WeatherSearchCriteria
            {
                CityName        = model.CityName,
                Date            = model.Date,
                TemperatureFrom = model.TemperatureFrom,
                TemperatureTo   = model.TemperatureTo,
                SunriseFrom     = model.SunriseFrom,
                SunriseTo       = model.SunriseTo
            };

            var weatherData = _weatherService.FindWeatherData(weatherSearchCriteria);
            var mapper      = new WeahterMapper();
            var results     = weatherData.Select(result => mapper.FromWeatherEntity(result)).ToList();

            var resultModel = new WeatherResultsModel {
                Results = results
            };

            return(View(resultModel));
        }