Exemplo n.º 1
0
        public async Task <List <PostResponse> > BuildFeed(Guid userId)
        {
            List <Post> posts = await PostRepository.BuildFeed(userId);

            List <PostResponse> postsResponse = new List <PostResponse>();

            foreach (Post post in posts)
            {
                PostResponse postResponse = new PostResponse
                {
                    Description = post.Description,
                    Id          = post.Id,
                    UserId      = post.UserId,
                    PhotoUrl    = post.PhotoUrl,
                    Comments    = await CommentService.GetAllCommentsOfAPost(post.Id)
                };
                postsResponse.Add(postResponse);
            }

            return(postsResponse);
        }