Exemplo n.º 1
0
 public static void KeywordsAdd(string kwd)
 {
     using (var db = new DBcontext())
     {
         if (!db.Keywords.Any(a => a.keyword == kwd))
         {
             db.Keywords.Add(new Keyword(kwd));
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
 public static void ChatsAdd(Chat chat)
 {
     using (var db = new DBcontext())
     {
         if (!db.Chats.Any(a => a.Id == chat.Id))
         {
             db.Chats.Add(new MChat(chat));
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 3
0
 public static void SpamersAdd(User user)
 {
     using (var db = new DBcontext())
     {
         if (!db.Spamers.Any(a => a.Id == user.Id))
         {
             db.Spamers.Add(new Spamer(user));
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 4
0
 public static void WantedListClear()
 {
     using (var db = new DBcontext())
     {
         foreach (var k in db.WantedList)
         {
             db.WantedList.Remove(k);
         }
         db.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public static void WantedListAdd(string username)
 {
     using (var db = new DBcontext())
     {
         if (!db.WantedList.Any(a => a.Username == username))
         {
             db.WantedList.Add(new Wantedlist(username));
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 6
0
 public static void GKeywordsClear()
 {
     using (var db = new DBcontext())
     {
         foreach (var k in db.GKeywords)
         {
             db.GKeywords.Remove(k);
         }
         db.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public static void KeywordsRemove(string kwd)
 {
     using (var db = new DBcontext())
     {
         var a = from b in db.Keywords where b.keyword == kwd select b;
         db.Keywords.Remove(a.Single());
         try
         {
             db.SaveChanges();
         }
         catch (Exception e) { }
     }
 }
Exemplo n.º 8
0
 public static void ChatsRemove(long chatid)
 {
     using (var db = new DBcontext())
     {
         var a = from b in db.Chats where b.Id == chatid select b;
         db.Chats.Remove(a.Single());
         try
         {
             db.SaveChanges();
         }
         catch (Exception e) { }
     }
 }
Exemplo n.º 9
0
 public static void RemoveSpamer(string username)
 {
     using (var db = new DBcontext())
     {
         var a = from b in db.Spamers where b.Username == username select b;
         db.Spamers.Remove(a.Single());
         try
         {
             db.SaveChanges();
         }
         catch (Exception e) { }
     }
 }