public string Execute(params string[] arguments)
        {
            int postId = int.Parse(arguments[0]);

            PostDetailsDto post = postService.ById <PostDetailsDto>(postId);

            // using automapper and mapping object to object
            //PostDetailsDto post = Mapper.Map<PostDetailsDto>(post);
            //done "by hand"
            //PostDetailsDto postDetailsDto = new PostDetailsDto()
            //{
            //    Id = post.Id,
            //    Title = post.Title,
            //    Content = post.Content,
            //    AuthorUsername = post.Author.UserName,
            //    Replies = post.Replies.Select(r=>new ReplyDto
            //    {
            //        Content = r.Content,
            //        AuthorUsername = r.Author.UserName,
            //    })
            //};

            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"Post: {post.Title} by {post.AuthorUsername}");
            foreach (var reply in post.Replies)
            {
                sb.AppendLine($"    Reply: {reply.Content} by {reply.AuthorUsername}");
            }

            return(sb.ToString());
        }
        public ICollection <LikeDto> Resolve(Post source, PostDetailsDto destination, ICollection <LikeDto> destMember, ResolutionContext context)
        {
            var likes     = _uow.Likes.GetAll().Where(i => i.PostId == source.Id);
            var forReturn = _mapper.Map <ICollection <LikeDto> >(likes).ToList();

            return(forReturn);
        }
        public async Task <IActionResult> OnGet()
        {
            var blog = await _blogAppService.GetByShortNameAsync(BlogShortName);

            if (blog == null)
            {
                return(RedirectToAction("E404", "Error"));
            }

            PostDetailsDto = await _postAppService.GetForReadingAsync(new GetReadPostInput
            {
                BlogId = blog.Id,
                Url    = Posturl
            });

            if (PostDetailsDto == null)
            {
                return(RedirectToAction("E404", "Error"));
            }

            return(Page());
        }