Ejemplo n.º 1
0
        public Task AddPackagesAsync(IEnumerable <PackageInput> packageInputs)
        {
            var byId  = SleetUtility.GetPackageSetsById(packageInputs, e => e.Identity.Id);
            var tasks = new List <Func <Task> >();

            // Create page details pages and index pages in parallel.
            tasks.AddRange(byId.Select(e => new Func <Task>(() => CreatePackageIndexAsync(e.Key, e.Value))));
            tasks.AddRange(packageInputs.Select(e => new Func <Task>(() => CreatePackagePageAsync(e))));

            return(TaskUtils.RunAsync(tasks));
        }
Ejemplo n.º 2
0
        public Task RemovePackagesAsync(IEnumerable <PackageIdentity> packagesToDelete)
        {
            var byId  = SleetUtility.GetPackageSetsById(packagesToDelete, e => e.Id);
            var tasks = new List <Func <Task> >();

            foreach (var pair in byId)
            {
                var packageId = pair.Key;
                var versions  = new HashSet <NuGetVersion>(pair.Value.Select(e => e.Version));
                tasks.Add(new Func <Task>(() => RemovePackagesFromIndexAsync(packageId, versions)));
            }

            return(TaskUtils.RunAsync(tasks));
        }