public void DeleteById(int id) { Order order = _contextDB.Orders.FirstOrDefault(x => x.Id == id); if (order == null) { throw new Exception($"Feedback with id {id} does not exist!"); } _contextDB.Orders.Remove(order); _contextDB.SaveChanges(); }
public void DeleteById(int id) { Pizza pizza = _contextDB.Pizzas.FirstOrDefault(x => x.Id == id); if (pizza == null) { throw new Exception($"Feedback with id {id} does not exist!"); } _contextDB.Pizzas.Remove(pizza); _contextDB.SaveChanges(); }
public void DeleteById(int id) { Feedback feedback = _contextDB.Feedback.FirstOrDefault(x => x.Id == id); if (feedback == null) { throw new Exception($"Feedback with id {id} does not exist!"); } _contextDB.Feedback.Remove(feedback); _contextDB.SaveChanges(); }