private PagedData<Task> GetSortedOnServerTasks(IQuery<Task, ReportInclude, ReportFilter, ReportSorter> query, int pageSize, int pageNumber, ReportListColumns column, SortDirection direction) { query.WithPaging(pageSize, pageNumber); switch (column) { case ReportListColumns.Title: { query.Sort(x => x.ByTitle(direction)); break; } case ReportListColumns.ProjectName: { query.Sort(x => x.ByProject(direction)); break; } case ReportListColumns.Step: { query.Sort(x => x.ByType(direction)); break; } } return TaskService.GetAll(query); }
private PagedData<Task> GetSortedOnClientTasks(IQuery<Task, ReportInclude, ReportFilter, ReportSorter> query, int pageSize, int pageNumber, ReportListColumns column, SortDirection direction) { var allData = TaskService.GetAll(query); var sortedData = allData.Data.AsEnumerable(); switch (column) { case ReportListColumns.Title: { sortedData = sortedData.SortBy(direction, x => x.Title); break; } case ReportListColumns.Step: { sortedData = sortedData.SortBy(direction, x => x.Type); break; } case ReportListColumns.ProjectName: { sortedData = sortedData.SortBy(direction, x => x.Project.Name); break; } } return new PagedData<Task>( sortedData.Skip(pageNumber * pageSize).Take(pageSize).ToList(), pageSize, pageNumber, allData.TotalItems); }