예제 #1
0
        public LayGridData GetPaper(SearchModel model, Expression <Func <T, bool> > criteria)
        {
            var parser = new UosoExpressionParser <T>();
            var filter = parser.ParserConditions(model.WhereLambda);

            filter = filter.And(criteria);
            //filter.
            var      itemCount = 0;
            List <T> ls        = new List <T>();

            if (model.WhereLambda.Count > 0)
            {
                ls = Context.Set <T>().Where(filter).OrderBy(model.field, model.order).Pager(model.page, model.limit, out itemCount).ToList();
            }
            else if (model.WhereLambda.Count == 0 && criteria != null)
            {
                ls = Context.Set <T>().Where(criteria).OrderBy(model.field, model.order).Pager(model.page, model.limit, out itemCount).ToList();
            }

            else
            {
                ls = Context.Set <T>().OrderBy(model.field, model.order).Pager(model.page, model.limit, out itemCount).ToList();
            }

            return(new LayGridData()
            {
                code = 0,
                count = (itemCount % model.limit == 0) ? itemCount / model.limit : itemCount / model.limit + 1,
                data = ls
            });
        }
예제 #2
0
        public IEnumerable <T> List(IEnumerable <UosoConditions> conditions)
        {
            var parser = new UosoExpressionParser <T>();
            var filter = parser.ParserConditions(conditions);

            return(List(filter));
        }