public ActionResult PageList(int offset = 0, int limit = 10, string search = "", string sort = "", string order = "")
        {
            int totalCount = 0;
            int pagenum    = offset / limit + 1;
            var basecodes  = _baseCodeService.Query(new BaseCodeQuery().WithAnySearch(search)).Include(n => n.CodeItems).OrderBy(n => n.OrderBy(sort, order)).SelectPage(pagenum, limit, out totalCount);
            var rows       = basecodes.Select(n => new { n.Id, n.CodeType, n.Description, CodeItems = String.Join("", n.CodeItems.Select(x => String.Format("<br>Code:{0} Text:{1}", x.Code, x.Text))) }).ToList();
            var pagelist   = new { total = totalCount, rows };

            return(Json(pagelist, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult GetData(int page = 1, int rows = 10, string sort = "Id", string order = "asc", string filterRules = "")
        {
            var filters    = JsonConvert.DeserializeObject <IEnumerable <filterRule> >(filterRules);
            int totalCount = 0;
            //int pagenum = offset / limit +1;
            var basecodes = _baseCodeService.Query(new BaseCodeQuery().Withfilter(filters)).OrderBy(n => n.OrderBy(sort, order)).SelectPage(page, rows, out totalCount);
            var datarows  = basecodes.Select(n => new { Id = n.Id, CodeType = n.CodeType, Description = n.Description }).ToList();
            var pagelist  = new { total = totalCount, rows = datarows };

            return(Json(pagelist, JsonRequestBehavior.AllowGet));
        }