public void DeleteDetail(int id)
        {
            var dtl = _context.Products.Find(id);

            _context.Products.Remove(dtl);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        public ActionResult <OrderItem> CreateDetail(Product product, int quantity)
        {
            OrderItem qwe = new OrderItem
            {
                ProductId = product.ProductId,
                ListPrice = product.ListPrice,
                Quantity  = quantity
            };

            _context.OrderItems.Add(qwe);
            _context.SaveChanges();
            return(_context.OrderItems.Find(qwe.OrderId));
        }