fixed general settings

This commit is contained in:
Flaminel
2025-06-15 03:30:25 +03:00
parent 458688770a
commit bd9f24eb1a
6 changed files with 99 additions and 13 deletions

View File

@@ -376,8 +376,12 @@ public class ConfigurationController : ControllerBase
var oldConfig = await _dataContext.GeneralConfigs
.FirstAsync();
// Apply updates from DTO
newConfig.Adapt(oldConfig);
// Apply updates from DTO, excluding the ID property to avoid EF key modification error
var config = new TypeAdapterConfig();
config.NewConfig<GeneralConfig, GeneralConfig>()
.Ignore(dest => dest.Id);
newConfig.Adapt(oldConfig, config);
// Persist the configuration
await _dataContext.SaveChangesAsync();