public JsonResult Create(PermissionItemType obj)
 {
     try
     {
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
     }
     return Json(new { IsSuccess = true });
 }
 private void GetChildren(IList<PermissionItemType> objList, PermissionItemType item, List<SystemTree> trees)
 {
     foreach (PermissionItemType k in item.children)
     {
         SystemTree tree = trees.Find(p => p.id == k.Id.ToString());
         List<PermissionItemType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList();
         k.children = kList;
         List<SystemTree> mlist = ConvertToTree(kList);
         tree.children = mlist;
         GetChildren(objList, k, mlist);
     }
 }
 private void GetChildren(IList<PermissionItemType> objList, PermissionItemType item)
 {
     foreach (PermissionItemType k in item.children)
     {
         List<PermissionItemType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList();
         k.children = kList;
         GetChildren(objList, k);
     }
 }