Пример #1
0
        public ActionResult GetPageData(int page = 1, int size = 10, string search = "")
        {
            Expression <Func <Broadcast, bool> > where = b => true;
            if (!string.IsNullOrEmpty(search))
            {
                where = where.And(b => b.Email.Contains(search));
            }

            var list      = BroadcastService.GetPagesFromCache(page, size, out var total, @where, b => b.UpdateTime, false).ToList();
            var pageCount = Math.Ceiling(total * 1.0 / size).ToInt32();

            return(Ok(new PageDataModel(list, pageCount, total)));
        }
Пример #2
0
        public ActionResult GetPageData(int page = 1, int size = 10, string search = "")
        {
            List <Broadcast> list;
            int total;

            if (string.IsNullOrEmpty(search))
            {
                list = BroadcastService.GetPagesFromCache(page, size, out total, b => true, b => b.UpdateTime, false).ToList();
            }
            else
            {
                list = BroadcastService.GetPagesFromCache(page, size, out total, b => b.Email.Contains(search), b => b.UpdateTime, false).ToList();
            }

            var pageCount = Math.Ceiling(total * 1.0 / size).ToInt32();

            return(Ok(new PageDataModel(list, pageCount, total)));
        }