public BlogArticleListPageDTO GetListPage(BlogArticleSearchDTO searchDTO) { long totalCount = 0; var entityList = this.dal.GetList(searchDTO, out totalCount); BlogArticleListPageDTO result = new BlogArticleListPageDTO(); result.TotalRecords = totalCount; result.PageSize = searchDTO.PageSize; result.List = entityList.Select(m => Mapper.DynamicMap <BlogArticleListItemPageDTO>(m)).ToList(); return(result); }
public BlogArticleListDTO GetList(JQueryDataTableSearchDTO searchDTO, IUserBasicInfo userInfo) { BlogArticleSearchDTO blogSearchDTO = new BlogArticleSearchDTO() { PageIndex = searchDTO.PageIndex, PageSize = searchDTO.iDisplayLength, UserID = userInfo.UserID }; BlogArticleListDTO result = new BlogArticleListDTO(); long totalCount = 0; var entityList = this.dal.GetList(blogSearchDTO, out totalCount); result.TotalRecords = totalCount; result.List = entityList.Select(m => Mapper.DynamicMap <BlogArticleListItemDTO>(m)).ToList(); return(result); }
public List <BlogArticleEntity> GetList(BlogArticleSearchDTO searchDTO, out long totalCount) { var sqlExp = GetSqlExp(); if (searchDTO.UserID > 0) { sqlExp.Where(m => m.UserID == searchDTO.UserID); } if (!string.IsNullOrEmpty(searchDTO.Title)) { sqlExp.Where(m => m.Title == searchDTO.Title); } if (!string.IsNullOrEmpty(searchDTO.Category)) { sqlExp.Where(m => m.Category == searchDTO.Category); } totalCount = base.Count(sqlExp); sqlExp.OrderByDescending(m => m.CreateTime); sqlExp.Select(m => new { m.ID, m.UserID, m.RealName, m.Title, m.Category, m.Summary, m.Traffic, m.CommentNum, m.UpdateTime, m.CreateTime, m.Remark, }); sqlExp.Limit((searchDTO.PageIndex - 1) * searchDTO.PageSize, searchDTO.PageSize); var list = base.QueryWhere(sqlExp); return(list); }
public ActionResult AjaxGetPageList(BlogArticleSearchDTO searchDTO) { var result = _blogArticleService.GetListPage(searchDTO); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(BlogArticleSearchDTO dto) { dto = dto ?? new BlogArticleSearchDTO(); return(View("index", dto)); }