Exemple #1
0
        /// <summary>
        /// 查询用户评论对象列表(根据作者查询)?????
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public AjaxResult <Pagination <UserCommentTargetListDto> > GetList(UserCommentTargetListReq req)
        {
            Pagination <UserCommentTargetListDto> page = new Pagination <UserCommentTargetListDto>();
            var query = from b in db.Usercommenttargetinfo
                        select new UserCommentTargetListDto
            {
                ID                 = b.Id,
                PlatformID         = b.PlatformId,
                PlatformName       = db.Subchannel.Where(w => w.Id == b.PlatformId).FirstOrDefault().SubChannelName,
                CommentType        = b.CommentType,
                CommentTypeName    = b.CommentType == (int)AIDB.Enum.UserCommentListEnum.CommentType.短文 ? "短文" : b.CommentType == (int)AIDB.Enum.UserCommentListEnum.CommentType.长文 ? "长文" : b.CommentType == (int)AIDB.Enum.UserCommentListEnum.CommentType.视频 ? "视频" : "",
                CommentTargetID    = b.CommentTargetId,
                CommentTargetTitle = b.CommentTargetTitle,
                Remark             = b.Remark,
                TableName          = b.TableName,
                SoureUrl           = b.SoureUrl,
                PinLunCount        = db.Usercommentlistinfo.Where(s => s.CommentTargetId == b.CommentTargetId).Count(),
            };

            if (req.PlatformID > 0)
            {
                query = query.Where(w => w.PlatformID == req.PlatformID);
            }
            if (req.CommentType > 0)
            {
                query = query.Where(w => w.CommentType == req.CommentType);
            }
            if (!string.IsNullOrWhiteSpace(req.CommentTargetTitle))
            {
                query = query.Where(w => w.CommentTargetTitle.Contains(req.CommentTargetTitle));
            }

            page.TotalCount = query.Count();
            page.dataList   = query.OrderByDescending(m => m.ID).Skip((req.PageIndex - 1) * req.PageSize).Take(req.PageSize).ToList();
            return(new AjaxResult <Pagination <UserCommentTargetListDto> >(page));
        }
Exemple #2
0
 public JsonResult Ajax_GetList(UserCommentTargetListReq req)
 {
     return(Json(ucl.GetList(req)));
 }