Beispiel #1
0
 public IActionResult GetWeather(string Country, string City)
 {
     try
     {
         Country = Country.Trim();
         City    = City.Trim();
         if (_weatherDataService.CheckCountryCityExist(Country, City))
         {
             return(Ok(_weatherDataService.GetWeather(Country, City)));
         }
         else
         {
             return(NotFound(string.Format("{0} City does not exist in {1}", City, Country)));
         }
     }
     catch
     {
         //log error
         return(StatusCode((int)HttpStatusCode.InternalServerError, "Server offline please try again later"));
     }
 }