示例#1
0
        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);
        }
示例#2
0
        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);
        }