コード例 #1
0
        public JsonResult GetMenuData()
        {
            System.Collections.Generic.List <Menu_info> activeList = new List <Menu_info> {
                new Menu_info()
                {
                    ID = 1, Name = "活动管理", ParentID = 0, Description = ""
                },
                new Menu_info()
                {
                    ID = 2, Name = "产品管理", ParentID = 0, Description = ""
                },
                new Menu_info()
                {
                    ID = 3, Name = "网站活动管理", ParentID = 1, Description = "/Active/Active/activeList"
                },
                new Menu_info()
                {
                    ID = 5, Name = "temp", ParentID = 2, Description = ""
                },
                new Menu_info()
                {
                    ID = 6, Name = "temp", ParentID = 2, Description = ""
                },
            };

            List <TreeData> tree = CommonTree.GetTreeData(activeList, "后台系统");

            return(this.Json(tree));
        }
コード例 #2
0
        //JsonBinder案例
        //public ActionResult InsertActive([ModelBinder(typeof(JsonBinder<Active_info>))]Active_info activeInfo)//[ModelBinder(typeof(DMLModelBinder))]Active_info activeInfo
        //{
        //    //Active_list activeList = new Active_list();
        //    //base.UpdateModel<Active_list>(activeList);
        //    throw new Exception("err");
        //    return new ContentResult() { Content = "success" };
        //}
        //TryUpdateModel案例
        //public ActionResult InsertActive(int ID,FormCollection formValue)
        //{
        //    //FormCollection
        //    Active_info activeInfo = new Active_info();
        //    base.TryUpdateModel<Active_info>(activeInfo,"", formValue.AllKeys,new string[] { Active_info._ID_ });
        //    return JsonManager.GetSuccess();
        //    //new ContentResult() { Content = "success" };
        //}

        public ActionResult GetActiveMenuData()
        {
            System.Collections.Generic.List <ActiveMenu_info> activeList = new List <ActiveMenu_info> {
                new ActiveMenu_info()
                {
                    ID = 1, Name = "日常活动", ParentID = 0
                },
                new ActiveMenu_info()
                {
                    ID = 2, Name = "长期活动", ParentID = 0
                },
                new ActiveMenu_info()
                {
                    ID = 3, Name = "黑五", ParentID = 1
                },
            };
            List <TreeData> tree = CommonTree.GetTreeData(activeList, "全部活动");

            return(this.Json(tree));
        }