public async System.Threading.Tasks.Task <IHttpActionResult> Get([FromUri] SearchCity request)
        {
            if (request.Period > 17)
            {
                request.Period = 17;
            }
            Forecast forecast = await forecastService.GetJsonFromUrl(request);

            return(Json(forecast));
        }
Exemplo n.º 2
0
        public async System.Threading.Tasks.Task <ActionResult> Index(SearchCity searchCity)
        {
            ViewBag.Search = true;
            Forecast forecast = await forecastService.GetJsonFromUrl(searchCity);

            if (forecast == null)
            {
                return(View("~/Views/Home/NotFoundCity.cshtml", new Forecast()
                {
                    City = new Models.City()
                    {
                        Name = searchCity.Name
                    }, Cnt = 1
                }));
            }
            forecast.Period = searchCity.Period;
            userAccount.Request(searchCity);
            return(View(forecast));
        }