public DeletePackageViewModel Setup( DeletePackageViewModel viewModel, Package package, User currentUser, IReadOnlyList <ReportPackageReason> reasons) { _displayPackageViewModelFactory.Setup(viewModel, package, currentUser, deprecation: null, readMeHtml: null); return(SetupInternal(viewModel, package, reasons)); }
public DeletePackageViewModel Create( Package package, User currentUser, IReadOnlyList <ReportPackageReason> reasons) { var viewModel = new DeletePackageViewModel(); return(Setup(viewModel, package, currentUser, reasons)); }
public DeletePackageViewModel Create( Package package, IReadOnlyCollection <Package> allVersions, User currentUser, IReadOnlyList <ReportPackageReason> reasons) { var viewModel = new DeletePackageViewModel(); return(Setup(viewModel, package, allVersions, currentUser, reasons)); }
public virtual ActionResult Delete(string id, string version) { var package = _packageService.FindPackageByIdAndVersion(id, version); if (package == null) { return(HttpNotFound()); } if (!package.IsOwner(User)) { return(new HttpStatusCodeResult(401, "Unauthorized")); } var model = new DeletePackageViewModel(package, ReportMyPackageReasons); return(View(model)); }
public DeletePackageViewModel Setup( DeletePackageViewModel viewModel, Package package, IReadOnlyCollection <Package> allVersions, User currentUser, IReadOnlyList <ReportPackageReason> reasons) { _displayPackageViewModelFactory.Setup( viewModel, package, allVersions, currentUser, packageKeyToDeprecation: null, readmeResult: null); return(SetupInternal(viewModel, package, reasons)); }
private DeletePackageViewModel SetupInternal( DeletePackageViewModel viewModel, Package package, IReadOnlyList <ReportPackageReason> reasons) { viewModel.DeletePackagesRequest = new DeletePackagesRequest { Packages = new List <string> { string.Format( CultureInfo.InvariantCulture, "{0}|{1}", package.PackageRegistration.Id, package.Version) }, ReasonChoices = reasons }; viewModel.IsLocked = package.PackageRegistration.IsLocked; return(viewModel); }
public virtual ActionResult Delete(string id, string version) { var package = _packageService.FindPackageByIdAndVersion(id, version); if (package == null) { return HttpNotFound(); } if (!package.IsOwner(User)) { return new HttpStatusCodeResult(401, "Unauthorized"); } var model = new DeletePackageViewModel(package, ReportMyPackageReasons); return View(model); }
public virtual ActionResult DeletePackage(string id, string version) { var package = packageSvc.FindPackageByIdAndVersion(id, version); if (package == null) { return PackageNotFound(id, version); } if (!package.IsOwner(HttpContext.User)) { return new HttpStatusCodeResult(401, "Unauthorized"); } var dependents = packageSvc.FindDependentPackages(package); var model = new DeletePackageViewModel(package, dependents); if (!model.MayDelete) { return new HttpStatusCodeResult(401, "Unauthorized"); } packageSvc.DeletePackage(id, version); TempData["Message"] = "The package was deleted"; return Redirect(Url.PackageList()); }
public virtual ActionResult Delete(string id, string version) { var package = packageSvc.FindPackageByIdAndVersion(id, version); if (package == null) { return PackageNotFound(id, version); } if (!package.IsOwner(HttpContext.User)) { return new HttpStatusCodeResult(401, "Unauthorized"); } var dependents = packageSvc.FindDependentPackages(package); var model = new DeletePackageViewModel(package, dependents); return View(model); }