예제 #1
0
        public ActionResult Seo(SeoSettingsModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
                return AccessDeniedView();

            var entity = new SeoSettings
            {
                CanonicalUrlsEnabled = model.CanonicalUrlsEnabled,
                DefaultMetaDescription = model.DefaultMetaDescription,
                DefaultMetaKeywords = model.DefaultMetaKeywords,
                DefaultTitle = model.DefaultTitle,
                PageTitleSeoAdjustment = model.PageTitleSeoAdjustment,
                PageTitleSeparator = model.PageTitleSeparator
            };

            _settingService.SaveSetting(entity);

            return RedirectToAction("Seo");
        }
예제 #2
0
        public ActionResult Seo()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
                return AccessDeniedView();

            var model = new SeoSettingsModel
            {
                CanonicalUrlsEnabled = _seoSettings.CanonicalUrlsEnabled,
                DefaultMetaDescription = _seoSettings.DefaultMetaDescription,
                DefaultMetaKeywords = _seoSettings.DefaultMetaKeywords,
                DefaultTitle = _seoSettings.DefaultTitle,
                PageTitleSeparator = _seoSettings.PageTitleSeparator
            };

            model.PageTitleSeoAdjustmentValues = _seoSettings.PageTitleSeoAdjustment
                .ToEnumList()
                .Select(x =>
                {
                    return new SelectListItem
                    {
                        Text = x.Name,
                        Value = x.Key,
                        Selected = ((int)x.Key.GetEnumValue<PageTitleSeoAdjustment>()).Equals((int)_seoSettings.PageTitleSeoAdjustment)
                    };
                }).ToList();

            return View(model);
        }