Exemplo n.º 1
0
        public void RemoveFriend(User user)
        {
            UserRelation ur  = FriendsWith.FirstOrDefault(u => u.FriendWith == user);
            UserRelation ur2 = FriendsOf.FirstOrDefault(u => u.FriendOf == user);

            FriendsWith.Remove(ur);
            FriendsWith.Remove(ur2);
            FriendsOf.Remove(ur);
            FriendsOf.Remove(ur2);
        }
Exemplo n.º 2
0
 public async Task <IEnumerable <Person> > GetRequestedFriends(Person person, FriendsWith friendsWith)
 {
     // Get list of all requests going out from person - r -> but not <- r -
     return(await this.GetRightRelated(p1 => p1.Name == person.Name));
 }
Exemplo n.º 3
0
 public async Task <IEnumerable <Person> > GetFriendRequests(Person person, FriendsWith friendsWith)
 {
     // Get list of all requests coming in for person <- r - but not - r ->
     return(await this.GetLeftRelated(p1 => p1.Name == person.Name));
 }
Exemplo n.º 4
0
 public async Task <IEnumerable <Person> > GetConfirmedFriendsWithRelationshipAsync(Person person, FriendsWith friendsWith)
 {
     // Get list of all requests that have <- r -> because they are confirmed both ways
     return(await this.GetDualRelated(p1 => p1.Name == person.Name, friendsWith));
 }
Exemplo n.º 5
0
 public void AddFriend(User user)
 {
     FriendsWith.Add(new UserRelation(this, user));
     FriendsOf.Add(new UserRelation(user, this));
 }
Exemplo n.º 6
0
 public async Task CreateFriendRelationshipAsync(Person person, Person friend, FriendsWith friendsWith)
 {
     // Creates relationship person1 -> person2
     await this.Relate <Person, FriendsWith>(p1 => p1.Name == person.Name, p2 => p2.Name == friend.Name, friendsWith);
 }