Exemplo n.º 1
0
        public JsonResult getTree(string checkedId)
        {
            var nodes = _dictIndexService.GetAll().Select(x => new ZTree(x.Id, x.Name, x.ParentID));
            var tree  = ZTreeHelper.ToJson(nodes, "/Dicts", checkedId);

            return(Json(tree));
        }
Exemplo n.º 2
0
        public JsonResult getTree(string checkedId, string groupby = "org")
        {
            IEnumerable <ZTree> nodes = null;

            switch (groupby)
            {
            case "role":
                nodes = _roleService.GetAll().Select(x => new ZTree(x.Id, x.Name, ""));
                break;

            case "group":
                nodes = _userGroupService.GetAll().Select(x => new ZTree(x.Id, x.Name, ""));
                break;

            default:    //Org
                nodes = _departmentService.GetAll().Select(x => new ZTree(x.Id, x.Name, x.ParentID));
                break;
            }
            var tree = ZTreeHelper.ToJson(nodes, "/User?groupby=" + groupby, checkedId);

            return(Json(tree));
        }