Esempio n. 1
0
        public ActionResult <Weather> GetByDay(string value)
        {
            var weatherByCity = _weatherService.Get_ByCity(value);

            if (weatherByCity != null)
            {
                return(weatherByCity);
            }

            var number = WeatherService.CityToNumber(value);
            var words  = value.Split('-');
            var day    = int.Parse(words[3]) - int.Parse(words[2]);

            var weather = _weatherService.GetJson(new Weather(), number, day);

            if (weather == null)
            {
                return(StatusCode(418));
            }

            return(weather);
        }