public void SaveGlobalConfiguration(PluginConfigurationEntity globalConfiguration) { if (!GlobalConfigurationRepository.Entities.Any()) GlobalConfigurationRepository.Insert(new GlobalConfiguration()); var configuration = GlobalConfigurationRepository.Entities.First(); Mapper.Map(globalConfiguration, configuration); GlobalConfigurationRepository.Update(configuration); }
public void SaveGlobalConfiguration(PluginConfigurationEntity globalConfiguration) { if (!GlobalConfigurationRepository.Entities.Any()) GlobalConfigurationRepository.Insert(new GlobalConfiguration()); var configuration = GlobalConfigurationRepository.Entities.First(); Mapper.Map(globalConfiguration, configuration); GlobalConfigurationRepository.Update(configuration); var jenkinsServers = JenkinsServerConfigurationRepository .GetAllSatisfiedBy(x => x.GlobalConfigurationId == configuration.GlobalConfigurationId) .ToArray(); UpdateCollectionHelper.UpdateCollection(jenkinsServers, globalConfiguration.JenkinsServers, JenkinsServerConfigurationRepository, Mapper, (d, b) => d.Name == b.Name, d => d.GlobalConfigurationId = configuration.GlobalConfigurationId); }