예제 #1
0
        public async Task OnGetAsync()
        {
            try
            {
                var posts = await pcc.GetPostsAsync();

                foreach (var item in posts)
                {
                    // Trebuia folosit AutoMapper. Transform Post in PostDTO
                    PostDTO pd = new PostDTO();
                    pd.Description = item.Description;
                    pd.PostId      = item.PostId;
                    pd.Domain      = item.Domain;
                    pd.Date        = item.Date;
                    foreach (var cc in item.Comments)
                    {
                        CommentDTO cdto = new CommentDTO();
                        cdto.PostPostId = cc.PostPostId;
                        cdto.Text       = cc.Text;
                        pd.Comments.Add(cdto);
                    }
                    Posts.Add(pd);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
예제 #2
0
        public async Task OnGetAsync()
        {
            var posts = await pcc.GetPostsAsync();

            foreach (var item in posts)
            {
                // Trebuia folosit AutoMapper. Transform Post in PostDTO
                var pd = new PostDTO
                {
                    Description = item.Description,
                    PostId      = item.PostId.ToString(),
                    Domain      = item.Domain,
                    Date        = item.Date
                };

                foreach (var cc in item.Comments)
                {
                    var cdto = new CommentDTO();
                    cdto.PostPostId = cc.PostPostId.ToString();
                    cdto.Text       = cc.Text;
                    pd.Comments.Add(cdto);
                }

                Posts.Add(pd);
            }
        }
예제 #3
0
        public async Task OnGetAsync()
        {
            var posts = await pcc.GetPostsAsync();

            foreach (var post in posts)
            {
                Posts.Add(ModelsMapper.GetPostDTO(post));
            }
        }
예제 #4
0
        public async Task OnGetAsync()
        {
            var posts = await pcc.GetPostsAsync();

            foreach (var post in posts)
            {
                Posts.Add(PostCommentDTO.GetPostDTO(post));
            }
        }
예제 #5
0
        public async Task OnGetAsync()
        {
            var posts = await pcc.GetPostsAsync();

            foreach (var item in posts)
            {
                PostDTO pd = new PostDTO();
                pd.Description = item.Description; pd.PostId = item.PostId; pd.Domain = item.Domain; pd.Date = item.Date;
                foreach (var cc in item.Comments)
                {
                    CommentDTO cdto = new CommentDTO();
                    cdto.PostPostId  = cc.PostPostId1;
                    cdto.CommentText = cc.Text;
                    pd.Comments.Add(cdto);
                }
                Posts.Add(pd);
            }
        }
예제 #6
0
        public async Task OnGetAsync()
        {
            var posts = await pcc.GetPostsAsync();

            foreach (var item in posts)
            {
                // Trebuia folosit AutoMapper. Transform Post in PostDTO
                Post pd = new Post();
                pd.Description = item.Description;
                pd.PostId      = item.PostId;

                pd.Date = item.Date;
                foreach (var cc in item.Comments)
                {
                    Comment cdto = new Comment();
                    cdto.PostPostId = cc.PostPostId;
                    cdto.Text       = cc.Text;
                    pd.Comments.Add(cdto);
                }
                Posts.Add(pd);
            }
        }