コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }