Example #1
0
        public ActionResult SaveSettings(string returnUrl)
        {
            var viewModel = new DisqusSettingsViewModel();

            TryUpdateModel(viewModel);

            if (ModelState.IsValid)
            {
                var settings = this.services.WorkContext.CurrentSite.As <DisqusSettingsPart>();

                settings.ShortName    = viewModel.ShortName;
                settings.SecretKey    = viewModel.SecretKey;
                settings.SyncComments = viewModel.SyncComments;
                settings.SyncInterval = viewModel.SyncInterval;

                this.services.Notifier.Information(this.T("Disqus settings saved"));
            }
            else
            {
                foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage))
                {
                    this.services.Notifier.Error(this.T(error));
                }
            }

            return(this.RedirectLocal(returnUrl, "~/"));
        }
Example #2
0
        public ActionResult SaveSettings(string returnUrl)
        {
            var viewModel = new DisqusSettingsViewModel();
            TryUpdateModel(viewModel);

            if (ModelState.IsValid)
            {
                var settings = this.services.WorkContext.CurrentSite.As<DisqusSettingsPart>();

                settings.ShortName = viewModel.ShortName;
                settings.SecretKey = viewModel.SecretKey;
                settings.SyncComments = viewModel.SyncComments;
                settings.SyncInterval = viewModel.SyncInterval;

                this.services.Notifier.Information(this.T("Disqus settings saved"));
            }
            else
            {
                foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage))
                {
                    this.services.Notifier.Error(this.T(error));
                }
            }

            return this.RedirectLocal(returnUrl, "~/");
        }
Example #3
0
        public ActionResult Settings()
        {
            var settings = this.services.WorkContext.CurrentSite.As <DisqusSettingsPart>();

            var viewModel = new DisqusSettingsViewModel
            {
                ShortName    = settings.ShortName,
                SecretKey    = settings.SecretKey,
                SyncComments = settings.SyncComments,
                SyncInterval = settings.SyncInterval
            };

            return(View(viewModel));
        }
Example #4
0
        public ActionResult Index()
        {
            var settings = this.services.WorkContext.CurrentSite.As<DisqusSettingsPart>();

            var viewModel = new DisqusSettingsViewModel
            {
                ShortName = settings.ShortName,
                SecretKey = settings.SecretKey,
                SyncComments = settings.SyncComments,
                SyncInterval = settings.SyncInterval
            };

            return View(viewModel);
        }