Ejemplo n.º 1
0
        public IActionResult UpdateCounty(int stateId, int id,
                                          [FromBody] CountyForUpdateDto county)
        {
            if (_myAppRepository.StateExists(stateId))
            {
                return(NotFound());
            }

            var countyEntity = _myAppRepository
                               .GetCountyForState(stateId, id);

            if (countyEntity == null)
            {
                return(NotFound());
            }

            _mapper.Map(county, countyEntity);

            _myAppRepository.UpdateCountyForState(stateId, countyEntity);

            _myAppRepository.Save();

            return(NoContent());
        }