diff --git a/GainsTracker.CoreAPI/Components/UserProfiles/Data/BigBrainUserProfile.cs b/GainsTracker.CoreAPI/Components/UserProfiles/Data/BigBrainUserProfile.cs index df8e0c7..989960c 100644 --- a/GainsTracker.CoreAPI/Components/UserProfiles/Data/BigBrainUserProfile.cs +++ b/GainsTracker.CoreAPI/Components/UserProfiles/Data/BigBrainUserProfile.cs @@ -19,13 +19,14 @@ public BigBrainUserProfile(AppDbContext context) : base(context) public UserProfile GetUserProfileByUserHandle(string userHandle, params PropertyToInclude[] properties) { string gainsId = GetGainsIdByUsername(userHandle); + List> includes = properties.ToList(); // If there's no include expression provided, get the standard user profile with icon. - if (properties.Length <= 0) - properties.ToList().Add(() => up => up.Icon); + if (includes.Count <= 0) + includes.Add(() => up => up.Icon); IQueryable query = Context.UserProfiles.AsQueryable(); - foreach (PropertyToInclude property in properties) + foreach (PropertyToInclude property in includes) query = query.Include(property.Invoke()); return query.FirstOrDefault(e => e.GainsAccountId == gainsId)