Exemplo n.º 1
0
        public ActionResult CancelPreview(string returnUrl)
        {
            if (!Services.Authorizer.Authorize(Permissions.ApplyTheme, T("Couldn't preview the current theme")))
            {
                return(new HttpUnauthorizedResult());
            }

            if (TempData.ContainsKey(AlreadyEnabledFeatures))
            {
                var alreadyEnabledFeatures = TempData[AlreadyEnabledFeatures] as IEnumerable <string>;
                if (alreadyEnabledFeatures != null)
                {
                    var afterEnabledFeatures = GetEnabledFeatures();
                    if (afterEnabledFeatures.Count() > alreadyEnabledFeatures.Count())
                    {
                        var disableFeatures = afterEnabledFeatures.Except(alreadyEnabledFeatures);
                        _themeService.DisablePreviewFeatures(disableFeatures);
                    }
                }
            }

            _previewTheme.SetPreviewTheme(null);

            return(RedirectToAction("Index"));
        }