Exemplo n.º 1
0
        public async Task <Page <Post> > SearchPost(int pageIndex, int pageSize)
        {
            var filterBuilder = Builders <PostEntity> .Filter;
            var sortBuilder   = Builders <PostEntity> .Sort;
            var sort          = sortBuilder.Descending(x => x.CreateTime);
            var searchResult  = await _postRep.PaginationSearchAsync(filterBuilder.Empty, sort, pageIndex : pageIndex,
                                                                     pageSize : pageSize);

            return(_mapper.Map <Page <Post> >(searchResult));
        }
Exemplo n.º 2
0
        public async Task <Page <Comment> > GetRootCommentListForPost(string postId, int pageIndex, int pageSize)
        {
            var filterBuilder = Builders <CommentEntity> .Filter;
            var filter        = filterBuilder.Eq(x => x.PostId, postId)
                                & filterBuilder.Eq(x => x.CommentParentId, null);
            var sort = Builders <CommentEntity> .Sort.Descending(x => x.CreateTime);

            var pageList = await _commentRep.PaginationSearchAsync(filter, sort, pageIndex, pageSize);

            return(_mapper.Map <Page <Comment> >(pageList));
        }