Exemple #1
0
        private void UpdateConfiguration(Entity.Configuration configuration,
                                         UpdateConfigurationDto updatedConfiguration)
        {
            configuration.Key      = updatedConfiguration.Key;
            configuration.Value    = updatedConfiguration.Value;
            configuration.IsActive = updatedConfiguration.IsActive;

            _context.Configurations.Update(configuration);
        }
Exemple #2
0
        private void Validate(IEnumerable <Entity.Configuration> configurations,
                              UpdateConfigurationDto updateConfiguration)
        {
            configurations = configurations.ToList();

            if (!configurations.Any())
            {
                throw new NotFoundException($"{updateConfiguration.Key} not found");
            }

            configurations =
                configurations.Where(config =>
                                     config.Key == updateConfiguration.Key &&
                                     config.Id != updateConfiguration.Id);

            if (configurations.Any())
            {
                throw new RecordAlreadyExistsException($"{updateConfiguration.Key} already exists.");
            }
        }
 public UpdateConfigurationCommand(UpdateConfigurationDto configuration)
 {
     Configuration = configuration;
 }