コード例 #1
0
        public async Task <Result <PagedList <CommentDto> > > List(FilterCommentQueryDto filterQueryDto)
        {
            var comments = await WhereAsyncAsNoTracking(c =>
                                                        (filterQueryDto.IsConfirmed == null || c.IsConfirmed == filterQueryDto.IsConfirmed) &&
                                                        (filterQueryDto.UserId == null || c.UserId == filterQueryDto.UserId),
                                                        filterQueryDto,
                                                        c => c.User, c => c.ParentComment, c => c.Children);

            return(Result <PagedList <CommentDto> > .SuccessFull(comments.MapTo <CommentDto>(_mapper)));
        }
コード例 #2
0
        public async Task <IActionResult> List([FromQuery] FilterCommentQueryDto filterQueryDto)
        {
            var result = await _unitOfWork.CommentService.List(filterQueryDto);

            if (filterQueryDto.Page == null && filterQueryDto.Limit == null)
            {
                return(Ok(result.Data.Items));
            }
            return(result.ApiResult);
        }