예제 #1
0
        public JsonResult Documents(GridItemsRequestModel input)
        {
            var items = _dynamicExpressionQuery.PerformQuery <Document>();
            var gridItemsViewModel = _documentListGrid.GetGridItemsViewModel(input.PageSortFilter, items);

            return(Json(gridItemsViewModel, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Documents(GridItemsRequestModel input)
        {
            var field = _repository.Find <Field>(input.ParentId);
            var documentWhereClause = _dynamicExpressionQuery.PrepareExpression <Document>(input.filters);
            IEnumerable <Document> items;

            if (documentWhereClause == null)
            {
                items = field.GetDocuments();
            }
            else
            {
                items = field.GetDocuments().Where(documentWhereClause.Compile());
            }
            var gridItemsViewModel = _documentListGrid.GetGridItemsViewModel(input.PageSortFilter, items.AsQueryable(),
                                                                             "documentGridContainer");

            return(Json(gridItemsViewModel, JsonRequestBehavior.AllowGet));
        }