Exemple #1
0
        public IActionResult General(GeneralSettingsViewModel model)
        {
            if (ModelState.IsValid)
            {
                _blogConfig.GeneralSettings.MetaKeyword = model.MetaKeyword;
                _blogConfig.GeneralSettings.SiteTitle   = model.SiteTitle;
                _blogConfig.GeneralSettings.Copyright   = model.Copyright.Replace("[c]", "©");
                _blogConfig.GeneralSettings.LogoText    = model.LogoText;
                _blogConfigurationService.SaveConfiguration(_blogConfig.GeneralSettings);

                _blogConfig.ContentSettings.DisharmonyWords = model.DisharmonyWords;
                _blogConfig.ContentSettings.EnableComments  = model.EnableComments;
                _blogConfigurationService.SaveConfiguration(_blogConfig.ContentSettings);

                _blogConfig.BlogOwnerSettings.Name             = model.BloggerName;
                _blogConfig.BlogOwnerSettings.Description      = model.BloggerDescription;
                _blogConfig.BlogOwnerSettings.ShortDescription = model.BloggerShortDescription;
                var response = _blogConfigurationService.SaveConfiguration(_blogConfig.BlogOwnerSettings);

                _blogConfig.RequireRefresh();
                return(Json(response));
            }
            return(Json(new FailedResponse((int)ResponseFailureCode.InvalidModelState, "Invalid ModelState")));
        }