コード例 #1
0
ファイル: HomeController.cs プロジェクト: sosleeply/html5
        public ActionResult Save()
        {
            //Id=0&text=name&iconCls=tools_3&controller=controller&expanded=1&view=view&leaf=1&xtypes=xtypes&sort=1&stated=add
            Menu m = new Menu();

            try {
                string stated = Request.Form["stated"];
                if (stated == "add")
                {
                    m.parent = Convert.ToInt32(Request.Form["Id"]);
                }
                else if (stated == "update")
                {
                    m.parent = Convert.ToInt32(Request.Form["parent"]);
                    m.Id     = Convert.ToInt32(Request.Form["Id"]);
                }
                m.text       = Request.Form["text"];
                m.iconCls    = Request.Form["iconCls"];
                m.controller = Request.Form["controller"];
                m.expanded   = Convert.ToInt32(Request.Form["expanded"]) == 0?false:true;
                m.view       = Request.Form["view"];
                m.leaf       = Convert.ToInt32(Request.Form["leaf"]) == 0 ? false : true;
                m.xtypes     = Request.Form["xtypes"];
                m.sort       = Convert.ToInt32(Request.Form["sort"]);

                MenuBLL mbll = new MenuBLL();
                if (stated == "add")
                {
                    if (mbll.AddEntity(m))
                    {
                        return(Content("{'success':'ok'}"));
                    }
                }
                else if (stated == "update")
                {
                    if (mbll.ModifyEntity(m))
                    {
                        return(Content("{'success':'ok'}"));
                    }
                }
            }
            catch { }
            return(Content("{}"));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: sosleeply/html5
        public ActionResult Save()
        {
            //Id=0&text=name&iconCls=tools_3&controller=controller&expanded=1&view=view&leaf=1&xtypes=xtypes&sort=1&stated=add
            Menu m = new Menu();
            try {
                string stated = Request.Form["stated"];
                if (stated == "add")
                    m.parent = Convert.ToInt32(Request.Form["Id"]);
                else if (stated == "update")
                {
                    m.parent = Convert.ToInt32(Request.Form["parent"]);
                    m.Id = Convert.ToInt32(Request.Form["Id"]);
                }
                m.text = Request.Form["text"];
                m.iconCls = Request.Form["iconCls"];
                m.controller = Request.Form["controller"];
                m.expanded = Convert.ToInt32(Request.Form["expanded"])==0?false:true;
                m.view = Request.Form["view"];
                m.leaf = Convert.ToInt32(Request.Form["leaf"]) == 0 ? false : true;
                m.xtypes = Request.Form["xtypes"];
                m.sort = Convert.ToInt32(Request.Form["sort"]);

                MenuBLL mbll = new MenuBLL();
                if (stated == "add") {
                    if (mbll.AddEntity(m)) {
                        return Content("{'success':'ok'}");
                    }
                }
                else if (stated == "update") {
                    if (mbll.ModifyEntity(m)){
                        return Content("{'success':'ok'}");
                    }
                }
            }
            catch { }
            return Content("{}");
        }