예제 #1
0
        public void UpdateLedConfig(Guid id, LedEffectDto ledEffect, string newName)
        {
            var oldConfig = _dbContext.LedConfigs.First(x => x.Id == id);

            oldConfig.Name       = newName;
            oldConfig.ConfigJson = JsonSerializer.Serialize(ledEffect);
            _dbContext.SaveChanges();
        }
예제 #2
0
        public void AddLedConfig(Guid id, string userId, LedEffectDto ledEffect, string newName, int ordinal)
        {
            var ledConfig = new LedEffect
            {
                Id         = id,
                UserId     = userId,
                Name       = newName,
                Version    = 1,
                Ordinal    = ordinal,
                ConfigJson = JsonSerializer.Serialize(ledEffect)
            };

            _dbContext.LedConfigs.Add(ledConfig);
            _dbContext.SaveChanges();
        }