public IActionResult DeleteTrail(int trailId) { if (!trailRepository.TrailsExit(trailId)) { return(NotFound()); } var data = trailRepository.GetTrail(trailId); if (!trailRepository.DeleteTrail(data)) { ModelState.AddModelError("", $"Something is Wrong when Updating the park {data.Name}"); return(StatusCode(500, ModelState)); } //if (!trailRepository.DeleteNationalPark(trailRepository.GetNationalPark(parkId))) //{ // ModelState.AddModelError("", $"Something is Wrong when Updating the park {data.Name}"); // return StatusCode(500, ModelState); //} return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { if (!_trailRepository.TrailExists(trailId)) { return(BadRequest()); } if (_trailRepository.DeleteTrail(trailId)) { return(NoContent()); } ModelState.AddModelError("server error", "something went wrong while deleting"); return(StatusCode(StatusCodes.Status500InternalServerError, ModelState)); }
public IActionResult DeleteTrail(int trailId) { if (!_trailRepository.TrailExists(trailId)) { return(NotFound()); } var trailObj = _trailRepository.GetTrail(trailId); if (!_trailRepository.DeleteTrail(_mapper.Map <Trail>(trailObj))) { ModelState.AddModelError(String.Empty, $"Something went wrong while Deleting the record {trailObj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { if (!_trailRepo.TrailExists(trailId)) { return(NotFound()); } var trailObj = _trailRepo.GetTrail(trailId); if (!_trailRepo.DeleteTrail(trailObj)) { ModelState.AddModelError("", "Something goes wrong"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int id) { if (!_trailRepository.TrailExists(id)) { return(NotFound()); } var trailObj = _trailRepository.GetTrail(id); if (!_trailRepository.DeleteTrail(trailObj)) { ModelState.AddModelError("", $"Something went wrong while updating {trailObj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { if (!_trailRepo.TrailExists(trailId)) { return(NotFound()); } var trailObj = _trailRepo.GetTrail(trailId); if (!_trailRepo.DeleteTrail(trailObj)) { ModelState.AddModelError("", $"Something went wrong when deleting the record {trailObj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int TrailId) { if (!_trailRepo.TrailExist(TrailId)) { return(NotFound()); } Trail Trail = _trailRepo.GetTrail(TrailId); if (!_trailRepo.DeleteTrail(Trail)) { ModelState.AddModelError("", $"Error with deleting file {Trail.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { if (!_tRepository.TrailExists(trailId)) { return(NotFound(new { message = "Data could not be found!" })); } var trailObj = _tRepository.GetTrail(trailId); if (!_tRepository.DeleteTrail(trailObj)) { return(StatusCode(500, new { message = "Something went wrong when deleting the record!" })); } return(Ok(new { message = "Data deleted successfully!" })); }
public IActionResult DeleteTrail(int id) { if (!TrailRepository.TrailExists(id)) { return(NotFound()); } var natParkObj = TrailRepository.GetTrail(id); if (!TrailRepository.DeleteTrail(natParkObj)) { ModelState.AddModelError("", $"Something went wrong when updating the record {natParkObj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int id) { if (!_repo.TrailExists(id)) { return(BadRequest(ModelState)); } var trail = _repo.GetTrail(id); if (!_repo.DeleteTrail(trail)) { ModelState.AddModelError("", "Something went wrong."); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int TrailId) { if (!trailRepository.CheckExistTrail(TrailId)) { return(NotFound()); } var obj = trailRepository.GetTrail(TrailId); if (!trailRepository.DeleteTrail(obj)) { ModelState.AddModelError(string.Empty, $"Something Wrong{obj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int id) { if (!_trailRepo.TrailExists(id)) { return(NotFound()); } var trail = _trailRepo.GetTrail(id); if (!_trailRepo.DeleteTrail(trail)) { ModelState.AddModelError("Message", $"Something went wrong when deleting trail {trail.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { if (!_trailRepository.TrailExist(trailId)) { return(NotFound()); } var ojbTrail = _trailRepository.GetTrail(trailId); if (!_trailRepository.DeleteTrail(ojbTrail)) { ModelState.AddModelError("", $"Something went wrong went deleting the recored {ojbTrail.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int id) { if (!_repo.TrailExists(id)) { return(NotFound()); } var trailObj = _repo.GetTrail(id); if (!_repo.DeleteTrail(trailObj)) { ModelState.AddModelError("", $"Error on server was occurred during deleting a object which have given id, this object: {trailObj}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { if (!_repository.TrailExists(trailId)) { return(NotFound()); } var domianObject = _repository.GetTrail(trailId); if (!_repository.DeleteTrail(domianObject)) { ModelState.AddModelError(string.Empty, $"Deleting record failed {domianObject.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult DeleteNationaPark(int trailId) { var obj = _trailRepo.GetTrail(trailId); if (obj == null) { return(NotFound()); } var dltobj = _mapper.Map <Trail>(obj); var deleteobj = _trailRepo.DeleteTrail(dltobj); if (!deleteobj) { ModelState.AddModelError("", $"Something went wrong when saving the record {dltobj.Name}"); } return(NoContent()); }
public IActionResult DeleteTrail(int trailId) { //ModelState contains all related encountered errors if (!_trailRepo.TrailExists(trailId)) { return(NotFound()); } var trailObj = _trailRepo.GetTrail(trailId); //If update was unsuccessful if (!_trailRepo.DeleteTrail(trailObj)) { ModelState.AddModelError("", $"Something went wrong when deleting the record {trailObj.Name}"); return(StatusCode(500, ModelState)); } return(NoContent()); }
public IActionResult Delete(Trail t) { _repository.DeleteTrail(t.Id); return(RedirectToAction("Detail", "Peak", new { peakId = t.PeakId })); }