internal UserRelationship GetOrAddRelationshipWith(User target) { var relationship = UserRelationships.FirstOrDefault(r => r.ToUserId == target.Id); if (relationship == null) { relationship = new UserRelationship(this, target); UserRelationships.Add(relationship); Logger?.LogInformation($"New relationship with user {target.Id}"); } return(relationship); }
public bool IsFriend(long userId) { return(UserRelationships.FirstOrDefault(r => r.ToUserId == userId)?.IsFriend ?? false); }