Example #1
0
 public JsonResult QueryData(BlogQueryInfo bqi)
 {
     var result = blogService.QueryData(bqi);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Example #2
0
        public IPagedList<BlogDto> QueryData(BlogQueryInfo bqi)
        {
            var query = this.Entities;
            if (bqi.title != null && !bqi.title.Trim().IsNullOrEmpty())
            {
                query = query.Where(w => w.title.Contains(bqi.title));
            }

            var dtoQuery = query.OrderBy(w => w.Id)
                  .Select(w => new BlogDto
                  {
                      id = w.Id,
                      title = w.title
                  });
            return dtoQuery.ToPagedList(bqi.PageIndex, bqi.PageSize);
        }