コード例 #1
0
        public ActionResult Menu(int?Code)
        {
            ViewBag.ParentMenuId = new SelectList(dbUser.getParentMenuList(), "MenuID", "MenuDescription");
            ViewBag.MenuType     = new SelectList(new List <Object>
            {
                new { value = "P", text = "Parent" },
                new { value = "C", text = "Child" },
            }, "value", "text");

            if (Code.HasValue && Code > 0)
            {
                var reqMenu = dbUser.getMenubyId(Code.Value);
                ViewBag.ParentMenuId = new SelectList(dbUser.getParentMenuList(), "MenuID", "MenuDescription", reqMenu.ParentMenuId);
                ViewBag.MenuType     = new SelectList(new List <Object>
                {
                    new { value = "P", text = "Parent" },
                    new { value = "C", text = "Child" },
                }, "value", "text", reqMenu.MenuType);
                return(View(reqMenu));
            }
            return(View());
        }