Ejemplo n.º 1
0
 public IActionResult GetCountries()
 {
     try
     {
         // Create new buffered client.
         var client    = new BufferedClient();
         var countries = client.GetCountries();
         return(Ok(countries));
     }
     catch (Exception ex)
     {
         LogError(ex);
         return(BadRequest(ex));
     }
 }
Ejemplo n.º 2
0
        public IActionResult PostCities(string countryCode, string adminCode1)
        {
            try
            {
                // If the input was invalid, throw a 400 error.
                if (string.IsNullOrWhiteSpace(countryCode))
                {
                    return(BadRequest(ModelState));
                }

                // Create new buffered client.
                var client = new BufferedClient();
                var cities = client.GetCities(countryCode, adminCode1);
                return(Ok(cities));
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(BadRequest(ex));
            }
        }