Ejemplo n.º 1
0
        public void AddProduct(Models.Menu.Product prod)
        {
            OrderProduct classOp = Products.FirstOrDefault(p => p.ProductID == prod.ProductID);

            if (classOp == null)
            {
                DataModels.OrderProduct op = new DataModels.OrderProduct
                {
                    Quantity  = prod.Quantity,
                    ProductID = prod.ProductID,
                    OrderID   = _order.OrderID
                };
                _context.OrderProducts.InsertOnSubmit(op);
                OrderProduct orderProd = new OrderProduct(op);
                orderProd.Price = (from p in _context.Products
                                   where p.ProductID == prod.ProductID
                                   select p.Price).First();
                _products = null;
            }
            else
            {
                classOp.Quantity++;
            }
        }
Ejemplo n.º 2
0
 public void AddProduct(Models.Menu.Product prod)
 {
     OrderProduct classOp = Products.FirstOrDefault(p => p.ProductID == prod.ProductID);
     if (classOp == null)
     {
         DataModels.OrderProduct op = new DataModels.OrderProduct
         {
             Quantity = prod.Quantity,
             ProductID = prod.ProductID,
             OrderID = _order.OrderID
         };
         _context.OrderProducts.InsertOnSubmit(op);
         OrderProduct orderProd = new OrderProduct(op);
         orderProd.Price = (from p in _context.Products
                            where p.ProductID == prod.ProductID
                            select p.Price).First();
         _products = null;
     }
     else
     {
         classOp.Quantity++;
     }
 }
Ejemplo n.º 3
0
 public OrderProduct(DataModels.OrderProduct p)
 {
     _product = p;
 }
Ejemplo n.º 4
0
 public OrderProduct(DataModels.OrderProduct p)
 {
     _product = p;
 }