예제 #1
0
        /// <summary>
        /// Gets the packages available online.
        /// </summary>
        /// <returns>IEnumerable&lt;PackageMeta&gt;.</returns>
        public async Task <IEnumerable <PackageMeta> > GetPackages()
        {
            var packages = await store.SourceSearch(null, allowPrereleaseVersions : false);

            // Order by download count and Id to allow collapsing
            var orderedPackages = packages.OrderByDescending(p => p.DownloadCount).ThenBy(p => p.Id);

            // For some unknown reasons, we can't select directly from IQueryable<IPackage> to IQueryable<PackageMeta>,
            // so we need to pass through a IEnumerable<PackageMeta> and translate it to IQueyable. Not sure it has
            // an implication on the original query behinds the scene
            return(orderedPackages.Select(PackageMetaFromNugetPackage));
        }