public ActionResult GetGrid(Pagination pagination, string keyword) { var data = new { rows = resourceApp.GetList(Base_WebSiteId), total = pagination.total, page = pagination.page, records = pagination.records }; return(Content(data.ToJson())); }
public async Task <ActionResult> GetResourceTree(string roleId) { var resourcedata = await resourceApp.GetList(); var authorizedata = new List <RoleAuthorizeEntity>(); if (!string.IsNullOrEmpty(roleId)) { authorizedata = await roleAuthorizeApp.GetListByObjectId(roleId); } var treeList = new List <TreeViewModel>(); foreach (ResourceEntity item in resourcedata) { TreeViewModel tree = new TreeViewModel(); bool hasChildren = resourcedata.Count(t => t.ParentClientId == item.ClientID) == 0 ? false : true; tree.id = item.ClientID; tree.text = item.Name.Replace("Controller", ""); tree.value = item.ClientID; tree.parentId = item.ParentClientId; tree.isexpand = true; tree.complete = true; tree.showcheck = true; tree.checkstate = authorizedata.Count(t => t.ItemId == item.ClientID); tree.hasChildren = hasChildren; //tree.img = item.Icon == "" ? "" : item.Icon; treeList.Add(tree); } return(Content(treeList.TreeViewJson())); }
public async Task <ActionResult> GetTreeGridJson() { var data = await resourceApp.GetList(); var treeList = new List <TreeGridModel>(); foreach (ResourceEntity item in data) { TreeGridModel treeModel = new TreeGridModel(); bool hasChildren = data.Count(t => t.ParentClientId == item.ClientID) == 0 ? false : true; treeModel.id = item.ClientID; treeModel.text = item.Name; treeModel.isLeaf = hasChildren; treeModel.expanded = true; treeModel.parentId = item.ParentClientId; treeModel.entityJson = item.ToJson(); treeList.Add(treeModel); } var rr = treeList.TreeGridJson(); return(Content(rr)); }