public IActionResult Index(WeatherViewModels vm) { vm.Latitude = 59.0M; vm.Longitude = 17.9M; return(View(vm)); }
public ActionResult Index() { var viewModel = new WeatherViewModels { CountryNames = GetCountries(), CityNames = new List <SelectListItem>() }; return(View(viewModel)); }
public IActionResult GetWeather(WeatherViewModels vm) { try { var smhiService = new SmhiService(); Rootobject result = smhiService.GetMeteorologicalForecast(vm.Longitude, vm.Latitude); vm.TimeTemps = smhiService.FilterTemperature(result, DateTime.Now); } catch (Exception ex) { vm.ErrorMessage = ex.Message; } return(View("Index", vm)); }
public IActionResult GetWeather(WeatherViewModels vm) { var smhiService = new SmhiServices(); try { Rootobject result = smhiService.GetMeteorologicalForecast(vm.Longitude, vm.Latitude); //List<TimeTemp> list = smhiService.FilterTemperature(result, vm.TimeTemps[0].Time); vm.TimeTemps = smhiService.FilterTemperature(result, DateTime.Now); }catch (Exception ex) { vm.ErrorMessage = ex.Message; } //vm.TimeTemps = new List<TimeTemp>(); //vm.TimeTemps.Add(new TimeTemp { Temp = 18, Time = DateTime.Now }); //vm.TimeTemps.Add(new TimeTemp { Temp = 16, Time = DateTime.Now }); return(View("Index", vm)); }
public MainPage() { this.InitializeComponent(); weatherViewModels = WeatherViewModels.GetInstance(); }