Exemplo n.º 1
0
        public IActionResult DeleteNationalPark(int id)
        {
            if (!_npRepo.NationalParkExists(id))
            {
                ModelState.AddModelError(string.Empty, "This Nationaal is not found");
                return(NotFound(ModelState));
            }

            var park = _npRepo.GetNationalPark(id);


            if (!_npRepo.DeleteNationalParkExists(park))
            {
                ModelState.AddModelError(string.Empty, $"Somthing went wrong when Deleting this park {park.Name}");
                return(StatusCode(500, ModelState));
            }
            return(NoContent());
        }