예제 #1
0
 public BlogConfigService(ILogger <BlogConfigService> logger,
                          IConfiguration configuration)
 {
     _logger              = logger;
     _configuration       = configuration;
     GeneralSettings      = new GeneralSettingsEntity();
     ContentSettings      = new ContentSettingsEntity();
     NotificationSettings = new NotificationSettingsEntity();
     FeedSettings         = new FeedSettingsEntity();
     WatermarkSettings    = new WatermarkSettingsEntity();
     FriendLinksSettings  = new FriendLinksSettingsEntity();
     AdvancedSettings     = new AdvancedSettingsEntity();
 }
예제 #2
0
        async Task _setValue(string settingName, string value)
        {
            var settings = await _getCache();

            var settingInstance = settings.FirstOrDefault(_ => _.PropertyName == settingName);

            if (settingInstance == null)
            {
                settingInstance = new GeneralSettingsEntity {
                    Id = Guid.NewGuid(), PropertyName = settingName
                };
                settings.Add(settingInstance);
            }

            settingInstance.PropertyValue = value;

            await _setCache(settings);
        }