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); }
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)); }
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)); }
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)); }
public void AddFriend(User user) { FriendsWith.Add(new UserRelation(this, user)); FriendsOf.Add(new UserRelation(user, this)); }
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); }