public void RemoveAll(int restaurantId) { var restaurant = GetRestaurantById(restaurantId); _context.RemoveRange(restaurant.Dishes); _context.SaveChanges(); }
public void RemoveAll(int restaurantId) { var dishes = GetRestaurantById(restaurantId).Dishes; _dbContext.RemoveRange(dishes); _dbContext.SaveChanges(); return; }
public void DeleteAllDishes(int restaurantId) { var restaurant = _context.Restaurants.Include(r => r.Dishes).FirstOrDefault(r => r.Id == restaurantId); if (restaurant is null) { throw new NotFoundException("Restaurant not found"); } _context.RemoveRange(restaurant.Dishes); _context.SaveChanges(); }