public IActionResult Index() { //Initialize initialize = new Initialize(); var db = GlobalDBContext.Instance(); //var db = CashierSystem_Service.GlobalDBContext.Instance(); //db.Add(new QP.CashierSystem_Model.Navs { Pid = 0, Area = "System", Controller = "home", Action = "index", IsNavi = true, IsHiddenMethod = false, CreateDate = DateTime.Now }); //db.SaveChanges(); //db.Add(new QP.CashierSystem_Model.Navs { Pid = 1, Area = "System", Controller = "home", Action = "index", IsNavi = true, IsHiddenMethod = false, CreateDate = DateTime.Now }); //db.SaveChanges(); //生成树形菜单 //var list = CashierSystem_Service.GlobalDBContext.Instance().Navs.Where( n => n.Area == "system").ToList(); //var rst = QP.Cashier.Utility.Array2Tree.ToTree(list); //调用写好的类,序列化成JSON格式 Cliet clite = new Cliet(); JieDian root = new JieDian(); //root.Name = "根节点"; //root.Id = 0; var list = new List <JieDian>(); clite.creatTheTree("0", root, out list); //根节点的parentBh值为"0" string json = Newtonsoft.Json.JsonConvert.SerializeObject(list); return(Json(json)); }
/// <summary> /// 找到菜单树形结构 /// </summary> /// <returns>菜单栏树形结构json数据</returns> private string FindMeanList() { Cliet clite = new Cliet(); JieDian root = new JieDian(); root.name = "主页"; root.url = "../Views/AppViews/Index.html"; root.id = "F000"; clite.creatTheTree("F000", root); //根节点的pid值为"0" string json = JsonConvert.SerializeObject(root); return(json); }
public IActionResult SubNavs(string id = "0") { Cliet clite = new Cliet(); JieDian root = new JieDian(); root.Name = "根节点"; root.Id = 0; var list = new List <JieDian>(); clite.creatTheTree(id, root, out list); //根节点的parentBh值为"0" string tree = Newtonsoft.Json.JsonConvert.SerializeObject(list); return(Json(list)); }
public IActionResult LeftNav(string id) { var DbContext = GlobalDBContext.Instance(); Cliet clite = new Cliet(); JieDian root = new JieDian(); root.Name = "根节点"; root.Id = 0; var list = new List <JieDian>(); clite.creatTheTree(id, root, out list); //根节点的parentBh值为"0" string json = Newtonsoft.Json.JsonConvert.SerializeObject(list); return(Json(json)); }