public List<Group> NotPrivateOrOwner(User u)
        {
            var NotPrivate = (from g in db.Groups
                                   where (g.IsPrivate == false)
                                   select g);

            var Private = (from g2 in u.Groups
                           where (g2.IsPrivate == true)
                           select g2);

            List<Group> TestNotPrivate = new List<Group>();
            TestNotPrivate = NotPrivate.ToList();

            List<Group> TestPrivate  = new List<Group>();

            //This if is here to keep user 0, our test user, from hitting this next line.
            if (u.UserId != 0)
            {
                TestPrivate = Private.ToList();
            }

            List<Group> Union = new List<Group>();
            Union.AddRange(TestNotPrivate);
            Union.AddRange(TestPrivate);

            //It is this operation that causes this not to be able to be converted into
            //a list
            //List<Group> TestUnion = Union.ToList();

            return (Union);
        }
        //Users
        //Setup the users.
        private void SetUpUsersAndGroups()
        {
            user2 = new User { UserId = 2, UserProfileId = 2 };
            user3 = new User { UserId = 3, UserProfileId = 3 };

            sublist1 = new List<User>();

            sublist1.Add(user2);
            sublist1.Add(user3);

            group1 = new Group { GroupID = 1, Users2 = sublist1, IsPrivate = true }; // Owner
            ownlist0 = new List<Group>();
            ownlist0.Add(group1);

            user0 = new User { UserId = 0, UserProfileId = 0, Groups = ownlist0 };
            user1 = new User { UserId = 1, UserProfileId = 1 };

            sublist0 = new List<User>();

            sublist0.Add(user0);
            sublist0.Add(user1);

            group0 = new Group { GroupID = 0, Users2 = sublist0, IsPrivate = false }; // Private

            sublist2 = new List<User>();

            sublist2.Add(user0);
            sublist2.Add(user3);

            user4 = new User { UserId = 4, UserProfileId = 4 };

            //Set up which group each user is subscribed to.

            group2 = new Group { GroupID = 2, Users2 = sublist2, IsPrivate = false }; // Don't show

            group3 = new Group { GroupID = 3, IsPrivate = true };
        }
 public void Delete(User user)
 {
     throw new NotImplementedException();
 }
 public void Add(User user)
 {
     throw new NotImplementedException();
 }
 /*
  * Name: Add
  * Description: Adds a user to the database.
  * Arguments: The user to add.
  */
 public void Add(User user)
 {
     db.Users.Add(user);
 }
 /*
  * Name: Delete
  * Description: Removes a user from the database.
  * Arguments: The user to remove.
  */
 public void Delete(User user)
 {
     db.Users.Remove(user);
 }