Exemplo n.º 1
0
        /// <summary>
        /// 查询YouTuBe视频列表
        /// </summary>
        /// <param name="req">平台信息</param>
        /// <returns></returns>
        public AjaxResult <Pagination <VideoyoutubeListDto> > GetList(VideoYouTuBeListReq req)
        {
            Pagination <VideoyoutubeListDto> page = new Pagination <VideoyoutubeListDto>();
            var query = from b in db.Videoyoutube
                        select new VideoyoutubeListDto
            {
                Id                = b.Id,
                YwTitle           = b.YwTitle,
                ZwTitle           = b.ZwTitle,
                Downloadurls      = b.Downloadurls,
                Localsrc          = b.Localsrc,
                Downloadtime      = b.Downloadtime,
                Posttime          = b.Posttime,
                Downloadstate     = b.Downloadstate,
                DownloadStateName = b.Downloadstate == (int)AIDB.Enum.VideoYouTuBeEnum.DownloadState.未下载? "未下载":
                                    b.Downloadstate == (int)AIDB.Enum.VideoYouTuBeEnum.DownloadState.已下载? "已下载":
                                    b.Downloadstate == (int)AIDB.Enum.VideoYouTuBeEnum.DownloadState.载失败 ? "下载失败" :"",
                Poststate     = b.Poststate,
                PostStateName = b.Poststate == (int)AIDB.Enum.VideoYouTuBeEnum.PostState.未发布 ? "未发布" :
                                b.Poststate == (int)AIDB.Enum.VideoYouTuBeEnum.PostState.已发布 ? "已发布" :
                                b.Poststate == (int)AIDB.Enum.VideoYouTuBeEnum.PostState.发布失败 ? "发布失败" : "",
            };

            if (!string.IsNullOrWhiteSpace(req.yw_title))
            {
                query = query.Where(w => w.YwTitle.Contains(req.yw_title));
            }
            if (!string.IsNullOrWhiteSpace(req.zw_title))
            {
                query = query.Where(w => w.ZwTitle.Contains(req.zw_title));
            }
            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 <VideoyoutubeListDto> >(page));
        }
Exemplo n.º 2
0
 public JsonResult Ajax_GetList(VideoYouTuBeListReq req)
 {
     return(Json(vytb.GetList(req)));
 }