コード例 #1
0
        public IActionResult General([FromServices] ITZoneResolver tZoneResolver)
        {
            var vm = new GeneralSettingsViewModel
            {
                LogoText                   = _blogConfig.GeneralSettings.LogoText,
                MetaKeyword                = _blogConfig.GeneralSettings.MetaKeyword,
                MetaDescription            = _blogConfig.GeneralSettings.MetaDescription,
                CanonicalPrefix            = _blogConfig.GeneralSettings.CanonicalPrefix,
                SiteTitle                  = _blogConfig.GeneralSettings.SiteTitle,
                Copyright                  = _blogConfig.GeneralSettings.Copyright,
                SideBarCustomizedHtmlPitch = _blogConfig.GeneralSettings.SideBarCustomizedHtmlPitch,
                SideBarOption              = _blogConfig.GeneralSettings.SideBarOption.ToString(),
                FooterCustomizedHtmlPitch  = _blogConfig.GeneralSettings.FooterCustomizedHtmlPitch,
                OwnerName                  = _blogConfig.GeneralSettings.OwnerName,
                OwnerEmail                 = _blogConfig.GeneralSettings.OwnerEmail,
                OwnerDescription           = _blogConfig.GeneralSettings.Description,
                OwnerShortDescription      = _blogConfig.GeneralSettings.ShortDescription,
                SelectedTimeZoneId         = _blogConfig.GeneralSettings.TimeZoneId,
                SelectedUtcOffset          = tZoneResolver.GetTimeSpanByZoneId(_blogConfig.GeneralSettings.TimeZoneId),
                SelectedThemeFileName      = _blogConfig.GeneralSettings.ThemeFileName,
                AutoDarkLightTheme         = _blogConfig.GeneralSettings.AutoDarkLightTheme
            };

            return(View(vm));
        }
コード例 #2
0
        public async Task <IActionResult> General(GeneralSettingsViewModel model, [FromServices] ITZoneResolver tZoneResolver)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _blogConfig.GeneralSettings.MetaKeyword                = model.MetaKeyword;
            _blogConfig.GeneralSettings.MetaDescription            = model.MetaDescription;
            _blogConfig.GeneralSettings.CanonicalPrefix            = model.CanonicalPrefix;
            _blogConfig.GeneralSettings.SiteTitle                  = model.SiteTitle;
            _blogConfig.GeneralSettings.Copyright                  = model.Copyright;
            _blogConfig.GeneralSettings.LogoText                   = model.LogoText;
            _blogConfig.GeneralSettings.SideBarCustomizedHtmlPitch = model.SideBarCustomizedHtmlPitch;
            _blogConfig.GeneralSettings.SideBarOption              = Enum.Parse <SideBarOption>(model.SideBarOption);
            _blogConfig.GeneralSettings.FooterCustomizedHtmlPitch  = model.FooterCustomizedHtmlPitch;
            _blogConfig.GeneralSettings.TimeZoneUtcOffset          = tZoneResolver.GetTimeSpanByZoneId(model.SelectedTimeZoneId).ToString();
            _blogConfig.GeneralSettings.TimeZoneId                 = model.SelectedTimeZoneId;
            _blogConfig.GeneralSettings.ThemeFileName              = model.SelectedThemeFileName;
            _blogConfig.GeneralSettings.OwnerName                  = model.OwnerName;
            _blogConfig.GeneralSettings.OwnerEmail                 = model.OwnerEmail;
            _blogConfig.GeneralSettings.Description                = model.OwnerDescription;
            _blogConfig.GeneralSettings.ShortDescription           = model.OwnerShortDescription;
            _blogConfig.GeneralSettings.AutoDarkLightTheme         = model.AutoDarkLightTheme;

            await _blogConfig.SaveAsync(_blogConfig.GeneralSettings);

            AppDomain.CurrentDomain.SetData("CurrentThemeColor", null);

            await _blogAudit.AddAuditEntry(EventType.Settings, AuditEventId.SettingsSavedGeneral, "General Settings updated.");

            return(Ok());
        }
コード例 #3
0
 public PostManageController(
     IPostService postService,
     ICategoryService catService,
     IBlogConfig blogConfig,
     ITZoneResolver tZoneResolver,
     ILogger <PostManageController> logger)
 {
     _postService   = postService;
     _blogConfig    = blogConfig;
     _catService    = catService;
     _tZoneResolver = tZoneResolver;
     _logger        = logger;
 }
コード例 #4
0
 public PostManageController(
     IPostService postService,
     IBlogConfig blogConfig,
     ITZoneResolver tZoneResolver,
     IPingbackSender pingbackSender,
     ILogger <PostManageController> logger)
 {
     _postService    = postService;
     _blogConfig     = blogConfig;
     _tZoneResolver  = tZoneResolver;
     _pingbackSender = pingbackSender;
     _logger         = logger;
 }
コード例 #5
0
 public EditPostModel(
     ICategoryService catService,
     IPostService postService,
     ITZoneResolver tZoneResolver,
     IBlogConfig blogConfig)
 {
     _catService    = catService;
     _postService   = postService;
     _tZoneResolver = tZoneResolver;
     ViewModel      = new()
     {
         IsPublished      = false,
         Featured         = false,
         EnableComment    = true,
         ExposedToSiteMap = true,
         FeedIncluded     = true,
         LanguageCode     = blogConfig.ContentSettings.DefaultLangCode
     };
 }
コード例 #6
0
 public MetaWeblogService(
     IBlogConfig blogConfig,
     ITZoneResolver tZoneResolver,
     ILogger <MetaWeblogService> logger,
     ITagService tagService,
     ICategoryService categoryService,
     IPostService postService,
     IPageService pageService,
     IBlogImageStorage blogImageStorage,
     IFileNameGenerator fileNameGenerator)
 {
     _blogConfig        = blogConfig;
     _tZoneResolver     = tZoneResolver;
     _logger            = logger;
     _tagService        = tagService;
     _categoryService   = categoryService;
     _postService       = postService;
     _pageService       = pageService;
     _blogImageStorage  = blogImageStorage;
     _fileNameGenerator = fileNameGenerator;
 }
コード例 #7
0
ファイル: MetaWeblogService.cs プロジェクト: xrcdev/Moonglade
 public MetaWeblogService(
     IOptions <AuthenticationSettings> authOptions,
     IBlogConfig blogConfig,
     ITZoneResolver tZoneResolver,
     ILogger <MetaWeblogService> logger,
     ITagService tagService,
     ICategoryService categoryService,
     IPostService postService,
     IPageService pageService,
     IBlogImageStorage blogImageStorage,
     IFileNameGenerator fileNameGenerator)
 {
     _authenticationSettings = authOptions.Value;
     _blogConfig             = blogConfig;
     _tZoneResolver          = tZoneResolver;
     _logger            = logger;
     _tagService        = tagService;
     _categoryService   = categoryService;
     _postService       = postService;
     _pageService       = pageService;
     _blogImageStorage  = blogImageStorage;
     _fileNameGenerator = fileNameGenerator;
 }
コード例 #8
0
 public GeneralModel(IBlogConfig blogConfig, ITZoneResolver tZoneResolver)
 {
     _blogConfig    = blogConfig;
     _tZoneResolver = tZoneResolver;
 }