示例#1
0
        public List <ProductDetails> GetOrderLineProductsByOrderId(long orderId)
        {
            Order order = OrderDao.Find(orderId);
            List <ProductDetails> productsDetails = new List <ProductDetails>();

            for (int i = 0; i < order.OrderLines.Count; i++)
            {
                Product        p              = ProductDao.Find(order.OrderLines.ElementAt(i).productId);
                string         categoryName   = CategoryDao.Find(p.categoryId).name;
                ProductDetails productDetails = new ProductDetails(p.name, p.categoryId, categoryName, p.registerDate, order.OrderLines.ElementAt(i).unitPrize, p.productId, order.OrderLines.ElementAt(i).numberOfUnits, order.OrderLines.ElementAt(i).forGift);
                productsDetails.Add(productDetails);
            }

            return(productsDetails);
        }