Exemplo n.º 1
0
        public void InitializeAction()
        {
            ActionService actionService = new ActionService();

            Model.Action action = actionService.Add(new Model.Action
            {
                ActionType = "menu"
            });
            //关联Menu菜单和权限
            MenuService menuService = new MenuService();

            menuService.GetEntities(u => u.Id > 0).ToList().ForEach(m => m.Action.Add(action));
            Model.Action module = actionService.Add(new Model.Action
            {
                ActionType = "module"
            });
            //关联ActionModule表和Action表
            ActionModuleService actionModuleService = new ActionModuleService();

            actionModuleService.GetEntities(u => u.Id > 0).ToList().ForEach(m => m.Action.Add(module));
        }
Exemplo n.º 2
0
        public void InitializeActionModule()
        {
            ActionModuleService actionModuleService = new ActionModuleService();
            List <ActionModule> actionModuleLIst    = new List <ActionModule>();

            actionModuleService.Add(new ActionModule
            {
                ParentId = 0,
                Name     = "系统",
                Url      = "/system",
            });
            int pId = actionModuleService.GetEntities(u => u.Name == "系统").FirstOrDefault().Id;

            actionModuleService.Add(new ActionModule
            {
                ParentId = pId,
                Name     = "系统设置",
                Url      = "/systemsetting"
            });
            actionModuleService.Add(new ActionModule
            {
                ParentId = pId,
                Name     = "权限管理",
                Url      = "/action"
            });
            actionModuleService.Add(new ActionModule
            {
                ParentId = pId,
                Name     = "用户管理",
                Url      = "/user"
            });
            int systemeId = actionModuleService.GetEntities(u => u.Name == "系统设置").FirstOrDefault().Id;

            actionModuleLIst.Add(new ActionModule
            {
                ParentId = systemeId,
                Name     = "菜单管理",
                Url      = "/menu"
            });
            int cId = actionModuleService.GetEntities(u => u.Name == "权限管理").FirstOrDefault().Id;

            actionModuleLIst.Add(new ActionModule
            {
                ParentId = cId,
                Name     = "功能管理",
                Url      = "/function",
            });
            actionModuleLIst.Add(new ActionModule
            {
                ParentId = cId,
                Name     = "角色管理",
                Url      = "/role",
            });
            actionModuleLIst.Add(new ActionModule
            {
                ParentId = cId,
                Name     = "角色权限管理",
                Url      = "/roleauth",
            });
            actionModuleLIst.Add(new ActionModule
            {
                ParentId = cId,
                Name     = "角色用户管理",
                Url      = "/roleuser",
            });
            actionModuleLIst.Add(new ActionModule
            {
                ParentId = cId,
                Name     = "用户角色管理",
                Url      = "/userrole",
            });
            int userId = actionModuleService.GetEntities(u => u.Name == "用户管理").FirstOrDefault().Id;

            actionModuleLIst.Add(new ActionModule
            {
                ParentId = userId,
                Name     = "用户管理",
                Url      = "/usermanage",
            });
            actionModuleService.AddRange(actionModuleLIst);
        }