public virtual IQueryable <TModel> Where(IPagedListParameters pagedListParameters) { IQueryable <TModel> queryResults = DatabaseContext.Set <TModel>(); queryResults = queryResults.OrderBy(pagedListParameters.SortColumn, pagedListParameters.SortAssending); return(queryResults); }
public virtual IPagedList Where(Expression <Func <TModel, bool> > predicate, IPagedListParameters pagedListParameters) { IList <Expression <Func <TModel, bool> > > predicates = new List <Expression <Func <TModel, bool> > >(); predicates.Add(predicate); return(Where(predicates, pagedListParameters)); }
public virtual IPagedList GetAll(IPagedListParameters pagedListParameters) { var pagedResult = new PagedList(); IQueryable <TModel> queryResults = DatabaseContext.Set <TModel>(); if (!string.IsNullOrEmpty(pagedListParameters.SerchColumnName) && !string.IsNullOrEmpty(pagedListParameters.SerchColumnValue)) { queryResults = queryResults.Where(pagedListParameters.SerchColumnName, pagedListParameters.SerchColumnValue); } else if (!string.IsNullOrEmpty(pagedListParameters.SerchColumnValue)) { queryResults = queryResults.FullTextSearch(pagedListParameters.SerchColumnValue); } queryResults = queryResults.OrderBy(pagedListParameters.SortColumn, pagedListParameters.SortAssending); pagedResult.TotalRecordCount = queryResults.Count(); queryResults = queryResults.Skip(pagedListParameters.SkipCount).Take(pagedListParameters.TakeCount); //pagedResult.Data = queryResults.ToList(); pagedResult.Data = GenericHelper.GetTypedList(queryResults.AsEnumerable()); return(pagedResult); }
public GridData(IPagedListParameters pagedListParameters, string controllerName, string controllerExtension, string actionName, IEnumerable<IGridColumn> gridColumns, int total, IEnumerable<DropDownListData> filters, int rowCount) { Filters = filters; PagedListParameters = pagedListParameters; ControllerName = controllerName; ControllerExtension = controllerExtension; ActionName = actionName; GridColumns = gridColumns; Total = total; RowCount = rowCount; }
public virtual IPagedList Where(IList <Expression <Func <TModel, bool> > > predicates, IPagedListParameters pagedListParameters) { IPagedList pagedResult = new PagedList(); IQueryable <TModel> queryResults = DatabaseContext.Set <TModel>(); if (predicates != null) { queryResults = predicates.Aggregate(queryResults, (current, predicate) => current.Where(predicate)); } queryResults = queryResults.OrderBy(pagedListParameters.SortColumn, pagedListParameters.SortAssending); pagedResult.TotalRecordCount = queryResults.Count(); if (predicates != null) { queryResults = queryResults.Skip(pagedListParameters.SkipCount).Take(pagedListParameters.TakeCount); } pagedResult.Data = queryResults.ToList(); return(pagedResult); }