public PackagesForSelectedPageResult2(IEnumerable <IPackage> packages, PackagesForSelectedPageQuery2 query) { this.Packages = packages; this.TotalPackagesOnPage = packages.Count(); this.TotalPackages = query.TotalPackages; this.AllPackages = query.AllPackages; this.Query = query; }
public PackagesForSelectedPageResult2 (IEnumerable<IPackage> packages, PackagesForSelectedPageQuery2 query) { this.Packages = packages; this.TotalPackagesOnPage = packages.Count (); this.TotalPackages = query.TotalPackages; this.AllPackages = query.AllPackages; this.Query = query; }
IEnumerable <IPackage> GetFilteredPackagesBeforePagingResults(PackagesForSelectedPageQuery2 query) { if (query.AllPackages == null) { IQueryable <IPackage> packages = GetPackagesFromPackageSource(query.SearchCriteria); query.TotalPackages = packages.Count(); query.AllPackages = GetFilteredPackagesBeforePagingResults(packages); } return(query.AllPackages); }
void CreateReadPackagesTask() { var query = new PackagesForSelectedPageQuery2(this, allPackages, GetSearchCriteria()); packagesForSelectedPageQuery = query; task = taskFactory.CreateTask( () => GetPackagesForSelectedPageResult(query), OnPackagesReadForSelectedPage); }
IEnumerable <IPackage> GetPackagesForSelectedPage(IEnumerable <IPackage> allPackages, PackagesForSelectedPageQuery2 query) { return(allPackages .Skip(query.Skip) .Take(query.Take)); }
IEnumerable <IPackage> GetPackagesForSelectedPage(PackagesForSelectedPageQuery2 query) { IEnumerable <IPackage> filteredPackages = GetFilteredPackagesBeforePagingResults(query); return(GetPackagesForSelectedPage(filteredPackages, query)); }
PackagesForSelectedPageResult2 GetPackagesForSelectedPageResult(PackagesForSelectedPageQuery2 query) { IEnumerable <IPackage> packages = GetPackagesForSelectedPage(query); return(new PackagesForSelectedPageResult2(packages, query)); }