public async Task <IActionResult> DeleteCountry(int id) { var countryToDelete = await _repository.GetCountry(id); if (countryToDelete == null) { return(NotFound()); } _repository.DeleteCountry(countryToDelete); if (!await _repository.Save()) { throw new Exception("Failed"); } return(NoContent()); }