Exemple #1
0
        public IActionResult Delete(int nationalParkId)
        {
            if (!_nationalParkRepository.ExsistsById(nationalParkId))
            {
                return(NotFound());
            }
            NationalPark nationalPark = (NationalPark)_nationalParkRepository.GetById(nationalParkId);

            if (!_nationalParkRepository.Delete(nationalPark))
            {
                ModelState.AddModelError("", $"Something went wrong deleting the record {nationalPark}");
                return(StatusCode(500, ModelState));
            }
            return(NoContent());
        }