public bool Remove(int id) { City removeCity = _cityRepo.Read(id); if (removeCity != null) { return(_cityRepo.Delete(removeCity)); } return(false); }
public bool Remove(int id) { City city = _cityRepo.Read(id); if (city == null) { return(false); } else { return(_cityRepo.Delete(city)); } }
public async Task <ActionResult> DeleteCityByID(int id) { try { var oldCity = await _cityRepo.GetCityById(id); if (oldCity == null) { return(NotFound($"Couldn't find any city with id: {id}")); } _cityRepo.Delete(oldCity); if (await _cityRepo.Save()) { return(NoContent()); } } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}")); } return(BadRequest()); }
public bool Remove(int id) { return(_cityRepo.Delete(id)); }
public void DeleteCity(int id) { cityRepo.Delete(id); }
public async Task <bool> DeleteCityAsync(City city) { _cityRepo.Delete(city); return(await SaveChangesAsync()); }