Exemple #1
0
        public async Task <UserPageModel> BuildUserPageModelAsync(Guid userId, IList <Guid> forumIds)
        {
            var result = new UserPageModel();

            var user = await _dbContext.Users
                       .FirstOrDefaultAsync(x =>
                                            x.Id == userId);

            if (user == null)
            {
                return(null);
            }

            result.User = new UserModel
            {
                Id           = user.Id,
                DisplayName  = user.DisplayName,
                TotalTopics  = user.TopicsCount,
                TotalReplies = user.RepliesCount,
                GravatarHash = _gravatarService.HashEmailForGravatar(user.Email),
                Status       = user.Status
            };

            result.Posts = await _searchModelBuilder.SearchPostModels(forumIds, new QueryOptions(), userId);

            return(result);
        }