Esempio n. 1
0
        public void AddOrderProduct(OrderProduct orderProduct)
        {
            OrderProduct op = new OrderProduct();
            op.OrderId = orderProduct.Order.Id;
            op.ProductId = orderProduct.Product.Id;
            op.Quantity = orderProduct.Quantity;
            op.PriceAtPayment = orderProduct.PriceAtPayment;
            try
            {
                db.OrderProduct.Add(op);
                db.SaveChanges();

            }
            catch (Exception ex)
            {

                Console.Write(ex.InnerException);
                Console.Write(ex.Message);
            }
        }
Esempio n. 2
0
 public void Edit_OrderProduct(int id, OrderProduct editOd)
 {
     OrderProduct od = db.OrderProduct.FirstOrDefault(p => p.Id == id);
     od = editOd;
     db.SaveChanges();
 }