public async Task <IActionResult> DisplayUserProfile(string id) { if (!id.IsGuid()) { return(View("ProfileNotFound")); } var streamsIds = await _streamsIdRepository.GetStreamsIdsAsync(); var userStreamsId = streamsIds.FirstOrDefault(x => x.StreamsId == id); if (userStreamsId == null) { return(View("ProfileNotFound")); } var clientId = userStreamsId.ClientId; var profile = await _personalDataService.GetAsync(clientId); if (profile == null) { return(View("ProfileNotFound")); } var avatars = await _personalDataService.GetClientAvatarsAsync(new List <string> { clientId }); var user = UserModel.GetAuthenticatedUser(User.Identity); if (profile.Id == user.Id && profile.FirstName != user.FirstName) { var newIdentity = ClaimsHelper.UpdateFirstNameClaim(User.Identity, profile.FirstName); var principal = new ClaimsPrincipal(); principal.AddIdentity(newIdentity); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal); } var commentsViewModel = new CommentsViewModel { CommentsList = await GetUserComments(profile.Email), CommentAvatar = avatars[clientId] }; var userProfileViewModel = new UserProfileViewModel { Profile = profile, AvatarUrl = avatars[clientId], WinningsSum = await GetUserWinnigsSum(profile.Email), CreatedProjects = await GetCreatedProjects(profile.Email), ParticipatedProjects = await GetParticipatedProjects(profile.Email), WonProjects = await GetWonProjects(profile.Email), Comments = commentsViewModel, AuthLink = _settings.LykkeStreams.Authentication.Authority, IsLykkeMember = await IsUserLykkeMember(profile.Email), ExpertedProjects = await GetExpertedProjects(profile.Email) }; return(View("~/Views/UserProfile/UserProfile.cshtml", userProfileViewModel)); }