Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateCity([FromBody] CreateCityDto newCity)
        {
            if (newCity == null)
            {
                return(BadRequest("no new city"));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest("city object is poorly formatted"));
            }
            var cityToAdd = new CityDto();

            cityToAdd.Name       = newCity.Name;
            cityToAdd.Desciption = newCity.Description;

            await _dataStore.AddCity(cityToAdd);

            return(Ok(cityToAdd));
        }