public async Task <ActionResult> Comment(CommentSelectDto selectDto) { var comments = await _blogAppService.GetAdminArticleCommentsAsync(selectDto); ViewBag.Page = selectDto.Page; ViewBag.PageSize = selectDto.PageSize; ViewBag.TotalCount = comments.TotalCount; return(View(comments)); }
/// <summary> /// 评论条件查询(后台API) /// </summary> /// <param name="selectDto"></param> /// <returns></returns> public async Task <PagedResultDto <ArticleCommentOut> > GetAdminArticleCommentsAsync(CommentSelectDto selectDto) { var query = _articleCommentRepository .GetAll() .WhereTimeFrame(selectDto) .WhereIf(selectDto.Ip != null, p => p.Ip.Contains(selectDto.Ip)) .WhereIf(selectDto.ToExamine.HasValue, p => p.ToExamine == selectDto.ToExamine); var comments = await query .OrderByDescending(p => p.CreationTime) .WherePaging(selectDto) .ToListAsync(); int count = await query.CountAsync(); return(new PagedResultDto <ArticleCommentOut>(count, ObjectMapper.Map <List <ArticleCommentOut> >(comments))); }