コード例 #1
0
        private async Task <PostModel> ConvertPostPocoToPostModel(PostPoco postPoco)
        {
            var model = PostModel.FromPoco(postPoco);

            var userPoco = await this.UserService.GetUserById(postPoco.UserId);

            model.Author = new PostUserModel
            {
                UserId = userPoco.UserId,
                Name   = userPoco.Name
            };

            var tagsPoco = await this.GetPostTags(postPoco.PostId);

            model.Tags = tagsPoco.Select(TagModel.FromPoco).ToArray();

            model.Comments = await this.CommentService.GetCommentsWithPostId(postPoco.PostId);

            return(model);
        }