public ActionResult SyncMpMenu() { var local_menus = MpMenuDAL.Instance.GetList(); var wx_root = new MpMenuRootInfo(); wx_root.button = new List <MpMenuInfo>(); if (local_menus != null && local_menus.GetEnumerator().MoveNext()) { var local_root_menus = local_menus.Where(i => !i.ParentId.HasValue); if (local_root_menus != null && local_root_menus.GetEnumerator().MoveNext()) { IEnumerable <MpMenuLocationInfo> local_sub_menus = null; foreach (var lm in local_root_menus) { var wm = BuildWxMenu(lm); if (wm == null) { continue; } local_sub_menus = local_menus.Where(sm => sm.ParentId == lm.Id); if (local_sub_menus != null && local_sub_menus.Count() > 0) { wm.sub_button = new List <MpMenuInfo>(); foreach (var s_lm in local_sub_menus) { var s_wm = BuildWxMenu(s_lm); if (s_wm == null) { continue; } wm.sub_button.Add(s_wm); } } wx_root.button.Add(wm); } } } if (wx_root.button.Count > 0) { MpMenuHelper.CreateMenu(wx_root); } else { MpMenuHelper.ClearMenu(); } return(JsonContent(true)); }
// GET: Test public ActionResult TestGetMenuList() { var re = MpMenuHelper.GetMenuList(); return(Json(re)); }
// GET: Platform/Test public ActionResult Index() { var dataList = MpMenuHelper.GetMenuList(); return(Content(dataList)); }