public async Task <IViewComponentResult> InvokeAsync(string userId) { var user = await _userManager.FindByIdAsync(userId); var currUser = await _userManager.GetUserAsync(HttpContext.User); string currentUserId; currentUserId = currUser == null ? "" : currUser.Id; var viewModel = new UserViewModel() { UserId = user.Id, CurrentUserId = currentUserId, UserName = user.UserName, UserAddress = user.UserAddress, UserEmail = user.Email, UserReportCount = _reportService.GetReportsByReporterId(user.Id).Count, UserInvestigationCount = _investigationService.GetInvestigationsByReporterId(user.Id).Count, UserCommentCount = _commentService.GetAllCommentsByReporterId(user.Id).Count, UserLikeCount = _likeService.GetAllLikesByReporterId(user.Id).Count }; return(View(viewModel)); }