public async Task <IActionResult> DeleteRestaurant(int id) { var restaurant = await _restaurantsRepository.GetAsync(id); if (restaurant == null) { return(NotFound()); } _restaurantsRepository.Delete(restaurant); if (await _restaurantsRepository.SaveChangesAsync()) { return(NoContent()); } return(BadRequest()); }
public void Delete(string id) { var restaurant = GetRestaurantById(id); restaurantsRepository.Delete(restaurant); }