Beispiel #1
0
 //тут надо добавить информацию о постах
 private void GetParametrUsersAndGroupPosts()
 {
     using (ContextUserAndGroup db = new ContextUserAndGroup())
     {
         //var tt = db.UserAndGroups
     }
 }
Beispiel #2
0
 private IEnumerable <UserAndGroup> UserAndGroupCheked(int User_Id, int Group_Id)
 {
     using (ContextUserAndGroup bd = new ContextUserAndGroup())
     {
         var tt = bd.UserAndGroups.Where(p => p.User_id == User_Id).Intersect(bd.UserAndGroups.Where(p => p.Group_Id == Group_Id)).ToList();
         return(tt);
     }
 }
Beispiel #3
0
 private bool UserAndGroupAddBd(int User_Id, int Group_Id)
 {
     using (ContextUserAndGroup db = new ContextUserAndGroup())
     {
         IEnumerable <UserAndGroup> query = UserAndGroupCheked(User_Id, Group_Id);
         if (query.Count() == 0)
         {
             UserAndGroup UAG = new UserAndGroup
             {
                 User_id  = User_Id,
                 Group_Id = Group_Id
             };
             db.UserAndGroups.Add(UAG);
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }