public Package CreatePackage(IPackage nugetPackage, User currentUser) { ValidateNuGetPackage(nugetPackage); var packageRegistration = CreateOrGetPackageRegistration(currentUser, nugetPackage); var package = CreatePackageFromNuGetPackage(packageRegistration, nugetPackage); packageRegistration.Packages.Add(package); using (var tx = new TransactionScope()) { using (var stream = nugetPackage.GetStream()) { UpdateIsLatest(packageRegistration); packageRegistrationRepo.CommitChanges(); packageFileSvc.SavePackageFile(package, stream); tx.Complete(); } } NotifyIndexingService(); return(package); }
public Package CreatePackage(IPackage nugetPackage, User currentUser) { ValidateNuGetPackage(nugetPackage); var packageRegistration = CreateOrGetPackageRegistration(currentUser, nugetPackage); var package = CreatePackageFromNuGetPackage(packageRegistration, nugetPackage); packageRegistration.Packages.Add(package); using (var tx = new TransactionScope()) { using (var stream = nugetPackage.GetStream()) { UpdateIsLatest(packageRegistration); packageRegistrationRepo.CommitChanges(); packageFileSvc.SavePackageFile(package, stream); tx.Complete(); } } if (package.Status != PackageStatusType.Approved && package.Status != PackageStatusType.Exempted) { NotifyForModeration(package, comments: string.Empty); } NotifyIndexingService(); return(package); }