Esempio n. 1
0
        public async Task <ISiteSettings> SaveAsync(ISiteSettings siteSettings)
        {
            // Automatically generate an API key if one is not supplied
            if (String.IsNullOrWhiteSpace(siteSettings.ApiKey))
            {
                siteSettings.ApiKey = _keyGenerator.GenerateKey();
            }

            // Use default homepage route if a default route is not explicitly specified
            if (siteSettings.HomeRoute == null)
            {
                siteSettings.HomeRoute = new HomeRoute();
            }

            // Update settings
            var settings = await _dictionaryStore.UpdateAsync <SiteSettings>(Key, siteSettings);

            if (settings != null)
            {
                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation($"Settings for site '{settings.SiteName}' updated successfully");
                }
                // Expire cache
                _cacheManager.CancelTokens(this.GetType(), Key);
            }

            return(settings);
        }
Esempio n. 2
0
        public async Task <HttpsSettings> SaveAsync(HttpsSettings model)
        {
            var settings = await _dictionaryStore.UpdateAsync <HttpsSettings>(SettingsKey, model);

            if (settings != null)
            {
                _memoryCache.Set(SettingsKey, settings);
            }

            return(settings);
        }
Esempio n. 3
0
        public async Task <TourDescriptor> SaveAsync(TourDescriptor shellDescriptor)
        {
            // Update descriptor
            var descriptor = await _dictionaryStore.UpdateAsync <TourDescriptor>(Key, shellDescriptor);

            if (descriptor != null)
            {
                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation($"Shell descriptor updated successfully");
                }
                // Expire cache
                _cacheManager.CancelTokens(this.GetType(), Key);
            }

            return(descriptor);
        }
Esempio n. 4
0
        public async Task <PlatoFacebookSettings> SaveAsync(PlatoFacebookSettings model)
        {
            if (_logger.IsEnabled(LogLevel.Information))
            {
                _logger.LogInformation("Facebook settings updating");
            }

            var settings = await _dictionaryStore.UpdateAsync <PlatoFacebookSettings>(SettingsKey, model);

            if (settings != null)
            {
                _cacheManager.CancelTokens(this.GetType());
                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation("Facebook settings updated");
                }
            }

            return(settings);
        }
Esempio n. 5
0
        public async Task <IShellDescriptor> SaveAsync(IShellDescriptor shellDescriptor)
        {
            // Add & get features
            var features = await AddAndGetFeaturesAsync(shellDescriptor.Modules);;

            shellDescriptor.Modules = features.ToList();

            // Update descriptor
            var descriptor = await _dictionaryStore.UpdateAsync <ShellDescriptor>(Key, shellDescriptor);

            if (descriptor != null)
            {
                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation($"Shell descriptor updated successfully");
                }
                // Expire cache
                _cacheManager.CancelTokens(this.GetType(), Key);
            }

            return(descriptor);
        }