private IEnumerable <EntitySetWrapper> GetDataSets(int first, int count, OrderByInfo orderBy, IEnumerable <string> containers, IEnumerable <Func <EntitySet, bool> > filters)
        {
            var filteredSets = GetEntitySets(containers);
            IEnumerable <EntitySetWrapper> result;

            if (filters != null)
            {
                foreach (var filter in filters)
                {
                    filteredSets = filteredSets.Where(filter);
                }
                result = GetDataSetWrappers(filteredSets);
            }
            else
            {
                // Cache non filtered list for top lists.
                result = _allDataSets ?? (_allDataSets = GetDataSetWrappers(filteredSets));
            }

            var field = SortingFuncs[orderBy.Field];

            var sortedResult = orderBy.Direction == SortDirection.Asc
                ? result.OrderBy(field).ThenBy(SortingFuncs[Field.Date]).ThenBy(SortingFuncs[Field.Rating]).ThenBy(SortingFuncs[Field.Views]).ThenByDescending(SortingFuncs[Field.Name]).ThenByDescending(SortingFuncs[Field.Category])
                : result.OrderByDescending(field).ThenBy(SortingFuncs[Field.Date]).ThenBy(SortingFuncs[Field.Rating]).ThenBy(SortingFuncs[Field.Views]).ThenByDescending(SortingFuncs[Field.Name]).ThenByDescending(SortingFuncs[Field.Category]);

            return(count > 0
                ? sortedResult.Skip(first).Take(count)
                : sortedResult);
        }
 public DatasetListModel(int pageSize, int pageNumber, OrderByInfo orderBy, IEnumerable <string> containers, IEnumerable <Func <EntitySet, bool> > filters)
 {
     _orderBy    = orderBy;
     _pageSize   = pageSize;
     _pageNumber = pageNumber;
     _containers = containers;
     _filters    = filters;
 }
 public CommonListData()
 {
     OrderBy = new OrderByInfo()
     {
         Field = Field.Name, Direction = SortDirection.Asc
     };
     PageSize   = 15;
     PageNumber = 1;
 }
 public CommonListData(OrderByInfo orderBy, int pageSize, int pageNumber)
 {
     OrderBy = orderBy;
     PageSize = pageSize;
     PageNumber = pageNumber;
 }
 public CommonListData()
 {
     OrderBy = new OrderByInfo() { Field = Field.Name, Direction = SortDirection.Asc };
     PageSize = 15;
     PageNumber = 1;
 }
 public CommonListData(OrderByInfo orderBy, int pageSize, int pageNumber)
 {
     OrderBy    = orderBy;
     PageSize   = pageSize;
     PageNumber = pageNumber;
 }