コード例 #1
0
        public BLModel.Paged.ProductPurchaseDetail GetProductPurchaseDetailByID(int?_shippingPaymentID, int _skip, int _take)
        {
            var detail = _productRepository.GetDbSet().ToList().
                         Join(_productShoppingRepository.GetDbSet().ToList(), pro => pro.ProductID, pshop => pshop.ProductID,
                              (pro, pshop) => new { pro.ProductID, pro.ProductName, pro.ProductFile, pro.ProductImage, pro.ProductPrice, pro.ProductType, pro.ProductDesc, pshop.Date, pshop.UserID, pshop.ProductShoppingID, pshop.ShippingPaymentID })
                         .Where(pshop => pshop.ShippingPaymentID == _shippingPaymentID.Value).Where(p => p.ProductType.ToLower() == "hard copy").OrderByDescending(p => p.Date)
                         .AsQueryable();

            return(new BLModel.Paged.ProductPurchaseDetail
            {
                TotalCount = _productRepository.GetDbSet().ToList().Join(_productShoppingRepository.GetDbSet().ToList(), pro => pro.ProductID, pshop => pshop.ProductID, (pro, pshop) => new { pro, pshop }).Where(ps => ps.pshop.ShippingPaymentID == _shippingPaymentID.Value).Where(p => p.pro.ProductType.ToLower() == "hard copy").Count(),
                ProductPurchaseDetails = detail.Select(pro => new BLModel.ProductPurchase().InjectFrom(pro)).Cast <BLModel.ProductPurchase>().Skip(_skip).Take(_take).ToList()
            });
        }
コード例 #2
0
        public BLModel.Paged.ProductPurchaseDetail GetPagedProductByProductType(string productType, int userid, int skip, int take)
        {
            var detail = _productRepository.GetDbSet().ToList().
                         Join(_productShoppingRepository.GetDbSet().ToList(), pro => pro.ProductID, pshop => pshop.ProductID,
                              (pro, pshop) => new { pro.ProductID, pro.ProductName, pro.ProductFile, pro.ProductImage, pro.ProductPrice, pro.ProductType, pro.ProductDesc, pshop.Date, pshop.UserID })
                         .Where(p => p.ProductType.ToLower() == productType.ToLower() && p.UserID == userid).OrderByDescending(p => p.Date)
                         .Skip(skip).Take(take).AsQueryable();

            return(new BLModel.Paged.ProductPurchaseDetail
            {
                TotalCount = _productRepository.GetDbSet().ToList().Join(_productShoppingRepository.GetDbSet().ToList(), pro => pro.ProductID, pshop => pshop.ProductID, (pro, pshop) => new { pro, pshop }).Where(p => p.pro.ProductType.ToLower() == productType.ToLower() && p.pshop.UserID == userid).Count(),
                ProductPurchaseDetails = detail.Select(pro => new BLModel.ProductPurchase().InjectFrom(pro)).Cast <BLModel.ProductPurchase>().ToList()
            });
        }