Ejemplo n.º 1
0
        public void ChangeDbUnban(
            int AdminID,
            int UserID,
            string Reason,
            int ChannelMessageID = 0
            )
        {
            Temp.bannedUsers.Remove(UserID);
            BanHistory banHistory = new BanHistory
            {
                UserID           = UserID,
                Ban              = 1,
                Level            = 1,
                ChannelMessageID = ChannelMessageID,
                ReasonMessageID  = 0,
                AdminID          = AdminID,
                BanTime          = GetTime.GetUnixTime(),
                Reason           = Reason,
                Expires          = 0
            };

            using (var db = new BlacklistDatabaseContext())
            {
                db.BanHistorys.Add(banHistory);
                var bannedUser = db.BanUsers
                                 .Single(users => users.UserID == UserID);
                db.Remove(bannedUser);
                db.SaveChanges();
            }

            new UnBanCaller().UnBanCallerThread(UserID);
        }
Ejemplo n.º 2
0
 public bool RemoveGroupCfg(long GroupID)
 {
     using (var db = new BlacklistDatabaseContext())
     {
         try
         {
             var groupCfg = db.GroupConfig
                            .Single(groups => groups.GroupID == GroupID);
             db.Remove(groupCfg);
             db.SaveChanges();
             return(true);
         }
         catch (InvalidOperationException)
         {
             return(false);
         }
         catch
         {
             return(false);
         }
     }
 }