Ejemplo n.º 1
0
        public IQueryable <OrderItem> GetOrderItems()
        {
            SqlCatalogRepository catalog = new SqlCatalogRepository(_db);

            return(from oi in _db.OrderItems
                   select new OrderItem
            {
                OrderID = oi.OrderID,
                Quantity = oi.Quantity,
                DateAdded = oi.DateAdded,
                LineItemPrice = oi.LineItemPrice,
                Product = (from p in catalog.GetProducts()
                           where p.ID == oi.ProductID
                           select p
                           ).SingleOrDefault(),
            });
        }
        public IQueryable<OrderItem> GetOrderItems() {
           SqlCatalogRepository catalog = new SqlCatalogRepository(_db);

            return from oi in _db.OrderItems
                   select new OrderItem
                              {
                                  OrderID = oi.OrderID,
                                  Quantity = oi.Quantity,
                                  DateAdded=oi.DateAdded,
                                  LineItemPrice=oi.LineItemPrice, 
                                  Product = (from p in catalog.GetProducts()
                                             where p.ID == oi.ProductID
                                             select p
                                            ).SingleOrDefault(),
                                            

                              };
        }