コード例 #1
0
        public ActionResult ChangeTheme(IndexModel model) {
            if (!Services.Authorizer.Authorize(Permissions.ApplyTheme))
                return new HttpUnauthorizedResult();


            if (!ModelState.IsValid) {
                return RedirectToAction("ChangeTheme");
            }

            _syntaxHighlighterService.SetCurrentTheme(model.Theme);

            return RedirectToAction("ChangeTheme");
        }
コード例 #2
0
        public ActionResult ChangeTheme() {
            var themes = new List<string>();
            themes.AddRange(_syntaxHighlighterService.GetSupportedThemes());

            var currentTheme = _syntaxHighlighterService.GetCurrentTheme();

            var model = new IndexModel() {
                Theme = currentTheme,
                Themes = themes
            };

            return View(model);
        }