Exemple #1
0
        public ResponseListModel <production> GetProductList(ReqProductEn en)
        {
            var reVal = new ResponseListModel <production>();

            reVal.List = new List <production>();
            if (en.PageIndex <= 0)
            {
                en.PageIndex = 1;
            }
            var lst = ctx.production.AsQueryable();

            if (en.ProductType > 0)
            {
                lst = lst.Where(s => s.product_type == en.ProductType);
            }

            if (!string.IsNullOrWhiteSpace(en.ProductName))
            {
                lst = lst.Where(s => s.product_name.Contains(en.ProductName));
            }

            reVal.List = lst.Skip((en.PageIndex - 1) * en.PageSize)
                         .Take(en.PageSize)
                         .ToList();
            reVal.Total = lst.Count();
            return(reVal);
        }
        public ResponseListModel <production> GetProductList(ReqProductEn en)
        {
            var reVal = new ResponseListModel <production>();

            try
            {
                reVal = new ProductMgr().GetProductList(en);
            }
            catch (Exception ex)
            {
                reVal.Success = false;
                reVal.Message = ex.Message;
            }
            return(reVal);
        }