Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #3
0
        public async Task OnGetAsync()
        {
            var posts = await pcc.GetPostsAsync();

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

            foreach (var post in posts)
            {
                Posts.Add(PostCommentDTO.GetPostDTO(post));
            }
        }
Beispiel #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);
            }
        }
        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);
            }
        }