public bool Remove(int id) { Country removeCountry = _countryRepo.Read(id); if (removeCountry != null) { return(_countryRepo.Delete(removeCountry)); } return(false); }
public bool Remove(int id) { Country country = _countryRepo.Read(id); if (country == null) { return(false); } else { return(_countryRepo.Delete(country)); } }
public async Task <ActionResult> DeleteCountryByID(int id) { try { var oldCountry = await _countryRepo.GetCountryById(id); if (oldCountry == null) { return(NotFound($"Couldn't find any country with id: {id}")); } _countryRepo.Delete(oldCountry); if (await _countryRepo.Save()) { return(NoContent()); } } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}")); } return(BadRequest()); }
public IActionResult Delete(CountryVM model) { _countryRepos.Delete(model.Id); return(RedirectToAction("Index")); }
public bool Remove(int id) { return(_countryRepo.Delete(id)); }