Exemple #1
0
        public ActionResult GetAllActionInfos()
        {
            // jQuery easyui: table format: {total:32, rows:[{}{}]}

            // those data are passing through the Request from client, when the table is initialized.
            int pageSize  = int.Parse(Request["rows"] ?? "10");
            int pageIndex = int.Parse(Request["page"] ?? "1");
            int totalData = 0;

            string srchName   = Request["srchName"];
            string srchRemark = Request["srchRemark"];

            #region Old Pagination
            //// Get the current page data
            //// 如果有导航属性时,使用微软的默认序列化方式的时候会出现问题: 循环引用的问题
            //// 解决方案: 直接选要显示的属性(非导航属性)
            //var pageData = ActionInfoService.GetPageEntities(
            //    pageSize,
            //    pageIndex,
            //    out totalData,
            //    u => u.DelFlag == DelFlagEnum.Normal,
            //    u => u.Id,
            //    true).Select(u => new { u.Id, u.ActionName, u.Url, u.HttpMethod, u.IsMenu, u.MenuIcon, u.Sort, u.SubTime, u.ModifiedOn, u.Remark });
            #endregion

            var actionQueryParam = new ActionQueryParam()
            {
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                Total      = 0,
                SrchName   = srchName,
                SrchRemark = srchRemark
            };

            var pageData = ActionInfoService.LoadPageData(actionQueryParam)
                           .Select(u => new { u.Id, u.ActionName, u.Url, u.HttpMethod, u.IsMenu, u.MenuIcon, u.Sort, u.SubTime, u.ModifiedOn, u.Remark });


            var data = new { total = actionQueryParam.Total, rows = pageData.ToList() };

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