public PageBox Query(int pageIndex = 1, string Name = "") { var list = bll.Query(); if (!string.IsNullOrWhiteSpace(Name)) { list = list.Where(m => m.Name.Contains(Name)).ToList(); } PageBox page = new PageBox { PageIndex = pageIndex, PageCount = list.Count / PAGESIZE + (list.Count % PAGESIZE > 0 ? 1 : 0), Data = list.Skip((pageIndex - 1) * PAGESIZE).Take(PAGESIZE) }; return(page); }