public ActionResult Index(string postId) { PostDTOWithPaginatedComments postDTOWithPaginatedComments = postService.GetPostWithPaginatedComments(postId, pageSize: Settings.COMMENT_PAGE_SIZE); PostModelWithPaginatedComments postModelWithPaginatedComments = dataMapper.MapPostDTOToModelWithPaginatedComments(postDTOWithPaginatedComments); return(View(postModelWithPaginatedComments)); }
public PostDTOWithPaginatedComments GetPostWithPaginatedComments(string id, int pageSize) { PostEntityWithPaginatedComments postEntityWithPaginatedComments = postRepository.GetPostWithPaginatedComments(id, pageSize); PostDTOWithPaginatedComments postDTOWithPaginatedComments = dataMapper.MapPostEntityToDTOWithPaginatedComments(postEntityWithPaginatedComments); return(postDTOWithPaginatedComments); }
public PostModelWithPaginatedComments MapPostDTOToModelWithPaginatedComments(PostDTOWithPaginatedComments postDTOWithPaginatedComments) { if (postDTOWithPaginatedComments == null) { return(null); } PostDTO postDTO = postDTOWithPaginatedComments.Post; PaginationDTO <CommentDTO> commentPaginationDTO = postDTOWithPaginatedComments.CommentPaginationDTO; PostModelWithPaginatedComments postModelWithPaginatedComments = new PostModelWithPaginatedComments() { Post = MapPostDTOToModel(postDTO), CommentPaginationModel = MapCommentPaginationDTOToModel(commentPaginationDTO) }; return(postModelWithPaginatedComments); }