public JsonResult Get(int limit, int offset) { var lstRole = new List <Dto_Role>(); for (var i = 0; i < 20; i++) { var oModel = new Dto_Role(); oModel.ROLE_ID = Guid.NewGuid().ToString(); oModel.ROLE_NAME = "模块管理员" + i; oModel.DESCRIPTION = "某一个模块的管理员" + i; oModel.CREATETIME = DateTime.Now.ToString(); oModel.MODIFYTIME = DateTime.Now.ToString(); oModel.ROLE_DEFAULTURL = "/Home/Index"; lstRole.Add(oModel); } return(Json(lstRole, JsonRequestBehavior.AllowGet)); }
public JsonResult GetRole(int limit, int offset, string filter) { if (!string.IsNullOrEmpty(filter)) { var oJson = Newtonsoft.Json.JsonConvert.DeserializeObject <Dto_Role>(filter); } var lstRole = new List <Dto_Role>(); for (var i = 0; i < 20; i++) { var oModel = new Dto_Role(); oModel.ROLE_ID = Guid.NewGuid().ToString(); oModel.ROLE_NAME = "模块管理员" + i; oModel.DESCRIPTION = "某一个模块的管理员" + i; oModel.CREATETIME = DateTime.Now.ToString(); oModel.MODIFYTIME = DateTime.Now.ToString(); oModel.ROLE_DEFAULTURL = "/Home/Index"; lstRole.Add(oModel); } var total = lstRole.Count; var rows = lstRole.Skip(offset).Take(limit).ToList(); return(Json(new { total = total, rows = rows }, JsonRequestBehavior.AllowGet)); }