예제 #1
0
        public async Task ExecuteAsync(UpdateSeoSettingsCommand command, IExecutionContext executionContext)
        {
            var allSettings = await _dbContext
                              .Settings
                              .ToListAsync();

            _settingCommandHelper.SetSettingProperty(command, c => c.HumansTxt, allSettings, executionContext);
            _settingCommandHelper.SetSettingProperty(command, c => c.RobotsTxt, allSettings, executionContext);

            await _dbContext.SaveChangesAsync();

            _transactionScopeFactory.QueueCompletionTask(_dbContext, _settingCache.Clear);
        }
        public async Task ExecuteAsync(UpdateGeneralSiteSettingsCommand command, IExecutionContext executionContext)
        {
            var allSettings = await _dbContext
                              .Settings
                              .ToListAsync();

            _settingCommandHelper.SetSettingProperty(command, c => c.ApplicationName, allSettings, executionContext);

            using (var scope = _transactionScopeFactory.Create(_dbContext))
            {
                await _dbContext.SaveChangesAsync();

                await _autoUpdateService.SetLockedAsync(!command.AllowAutomaticUpdates);

                await scope.CompleteAsync();
            }

            _transactionScopeFactory.QueueCompletionTask(_dbContext, _settingCache.Clear);
        }