コード例 #1
0
        private ActionResult UninstallPackage(string id, string returnUrl, string retryUrl)
        {
            try {
                _packageManager.Uninstall(id, MapAppRoot());
            }
            catch (Exception exception) {
                Services.Notifier.Error(T("Uninstall failed: {0}", exception.Message));
                return(Redirect(!String.IsNullOrEmpty(retryUrl) ? retryUrl : returnUrl));
            }

            Services.Notifier.Information(T("Uninstalled package \"{0}\"", id));
            return(this.RedirectLocal(returnUrl, "~/"));
        }
コード例 #2
0
        public ActionResult UninstallPackage(string id, string returnUrl, string retryUrl)
        {
            if (_shellSettings.Name != ShellSettings.DefaultName || !Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to uninstall packages")))
            {
                return(new HttpUnauthorizedResult());
            }

            try {
                _packageManager.Uninstall(id, HostingEnvironment.MapPath("~/"));
            }
            catch (Exception exception) {
                Services.Notifier.Error(T("Uninstall failed: {0}", exception.Message));
                return(Redirect(retryUrl));
            }

            Services.Notifier.Information(T("Uninstalled package \"{0}\"", id));
            return(this.RedirectLocal(returnUrl, "~/"));
        }