Example #1
0
        public ActionResult GetRoleInfo()
        {
            //报文中请求自动发送 rows page
            int pageSize  = int.Parse(Request["rows"] ?? "5");
            int pageIndex = int.Parse(Request["page"] ?? "1");

            //多条件差寻过滤
            string searchName = Request["seacrchName"];

            var queryParam = new UserQueryParam()
            {
                PageSize   = pageSize,
                PageIndex  = pageIndex,
                Total      = 0,
                SearchName = searchName
            };
            //封装业务逻辑
            var temp     = roleInfoService.LoadPageData(queryParam);
            var pageData = temp.Select(u => new
            {
                u.ID,
                u.Name,
                u.SubTime,
                u.Remark,
                u.DelFlag
            });
            var data = new { total = queryParam.Total, rows = pageData.ToList() };

            //具有导航属性注意 循环序列化

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