public async Task <IActionResult> AddCity(string cityName) { if (cityName.IsNullOrWhiteSpaces()) { return(BadRequest("Invalid City Name")); } var createdCity = await CitiesRepository.CreateCity(cityName); return(Ok(createdCity)); }
public async Task <IActionResult> AddCityByCep(int cep) { if (cep < 10000000) { return(BadRequest("Invalid Cep")); } var city = await CepServices.GetCityByCep(cep); if (city == null) { return(BadRequest("City does not exists in this zip code")); } var createdCity = await CitiesRepository.CreateCity(city.Name); return(Ok(createdCity)); }