Exemple #1
0
        /// <summary>
        /// 获取商品列表
        /// </summary>
        /// <returns></returns>
        public ResultDto <PageDto <ProductRP> > GetProductPageList(ProductRQ rq)
        {
            //var aaa = L("OperationSucceeded");
            var result = new PageDto <ProductRP>(rq.pi, rq.ps)
            {
                lst = new List <ProductRP>()
            };

            int totalCount = 0;
            var list       = repository.wm_product.Where(q => q.DataStatus == (byte)EnumDataStatus.Enable)
                             .WhereIF(rq.ProductTypeID > 0, q => q.ProductTypeID == rq.ProductTypeID)
                             .WhereIF(!rq.Keywords.IsNullOrWhiteSpace(), q => q.Name.Contains(rq.Keywords))
                             //.WhereIF(rq.ProductTagID > 0, q => q.ProductTypeID == rq.ProductTagID)
                             .Select(q => new ProductRP
            {
                ID            = q.ID,
                Describe      = q.Describe,
                Hot           = q.Hot,
                Icon          = q.Icon,
                Image         = q.Image,
                Inventory     = q.Inventory,
                Name          = q.Name,
                Price         = q.Price,
                ProductTypeID = q.ProductTypeID,
                Remark        = q.Remark,
                Sales         = q.Sales,
                Sort          = q.Sort
            }).OrderBy(q => q.Sort)
                             .ToPageList(rq.pi, rq.ps, ref totalCount);

            result.pg.tc = totalCount;
            result.lst   = list;
            return(Result(result));
        }
        public IActionResult GetproductPageList(ProductRQ rq)
        {
            var r = _productService.GetProductPageList(rq);

            return(Ok(r));
        }