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 bool AreFriends(User user) { return(FriendsOf.Select(f => f.FriendOf).Any(f => f.UserId == user.UserId) || FriendsOf.Select(f => f.FriendWith).Any(f => f.UserId == user.UserId)); }
public void AddFriend(User user) { FriendsWith.Add(new UserRelation(this, user)); FriendsOf.Add(new UserRelation(user, this)); }