コード例 #1
0
        public async Task <IActionResult> Reload(string id)
        {
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenants))
            {
                return(Unauthorized());
            }

            if (!IsDefaultShell())
            {
                return(Unauthorized());
            }

            var shellContext = _orchardHost
                               .ListShellContexts()
                               .OrderBy(x => x.Settings.Name)
                               .Where(x => String.Equals(x.Settings.Name, id, StringComparison.OrdinalIgnoreCase))
                               .FirstOrDefault();

            if (shellContext == null)
            {
                return(NotFound());
            }

            // Generating routes can fail while the tenant is recycled as routes can use services.
            // It could be fixed by waiting for the next request or the end of the current one
            // to actually release the tenant. Right now we render the url before recycling the tenant.

            var redirectUrl = Url.Action(nameof(Index));

            var shellSettings = shellContext.Settings;

            _orchardHost.ReloadShellContext(shellSettings);

            return(Redirect(redirectUrl));
        }
コード例 #2
0
        public async Task <IActionResult> Reload(string id)
        {
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenants))
            {
                return(Unauthorized());
            }

            if (!IsDefaultShell())
            {
                return(Unauthorized());
            }

            var shellContext = _orchardHost
                               .ListShellContexts()
                               .OrderBy(x => x.Settings.Name)
                               .Where(x => String.Equals(x.Settings.Name, id, StringComparison.OrdinalIgnoreCase))
                               .FirstOrDefault();

            if (shellContext == null)
            {
                return(NotFound());
            }

            var shellSettings = shellContext.Settings;

            _orchardHost.ReloadShellContext(shellSettings);

            return(RedirectToAction(nameof(Index)));
        }