public ActionResult Edit(ModuleType obj) { try { NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return Json(new { IsSuccess = false, ErrorMsg = "出错了" }); } return Json(new { IsSuccess = true }); }
public JsonResult Create(ModuleType obj) { try { obj.CreateBy = CurrentUser.Realname; obj.CreateOn = DateTime.Now; NSession.SaveOrUpdate(obj); NSession.Flush(); } catch (Exception ee) { return Json(new { IsSuccess = false, ErrorMsg = "出错了" }); } return Json(new { IsSuccess = true }); }
private void GetChildren(IList<ModuleType> objList, ModuleType item, List<SystemTree> trees) { foreach (ModuleType k in item.children) { SystemTree tree = trees.Find(p => p.id == k.Id.ToString()); List<ModuleType> 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<ModuleType> objList, ModuleType item) { foreach (ModuleType k in item.children) { List<ModuleType> kList = objList.Where(p => p.ParentId == k.Id).OrderByDescending(p => p.SortCode).ToList(); k.children = kList; GetChildren(objList, k); } }