public bool ToggleAutoDc(ulong id) { bool val; using (var uow = _db.UnitOfWork) { var gc = uow.GuildConfigs.ForId(id, set => set); val = gc.AutoDcFromVc = !gc.AutoDcFromVc; uow.Complete(); } if (val) { AutoDcServers.Add(id); } else { AutoDcServers.TryRemove(id); } return(val); }
public bool ToggleAutoDc(ulong id) { bool val; using (var uow = _db.GetDbContext()) { var gc = uow.GuildConfigs.ForId(id, set => set); val = gc.AutoDcFromVc = !gc.AutoDcFromVc; uow.SaveChanges(); } if (val) { AutoDcServers.Add(id); } else { AutoDcServers.TryRemove(id); } return(val); }