Exemplo n.º 1
0
        public ActionResult Edit(long id)
        {
            var rolePerms = PermissionService.GetByRoleId(id);
            var allPerms  = PermissionService.GetAll();
            var role      = RoleService.GetById(id);
            RoleEditGetModel roleEditGetModel = new RoleEditGetModel();

            roleEditGetModel.AllPerms  = allPerms;
            roleEditGetModel.RolePerms = rolePerms;
            roleEditGetModel.Role      = role;
            return(View(roleEditGetModel));
        }
Exemplo n.º 2
0
        public ActionResult Edit(long id)
        {
            var role               = roleService.GetById(id);
            var rolePerms          = permService.GetByRoleId(id); //id这个角色拥有的权限项
            var allPerms           = permService.GetAll();        //全部的权限
            RoleEditGetModel model = new RoleEditGetModel();

            model.Role      = role;
            model.RolePerms = rolePerms;
            model.AllPerms  = allPerms;
            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult Edit(long id)
        {
            var role      = roleservice.GetById(id);
            var rolePerms = permservice.GetByRoleId(id);
            var allperms  = permservice.GetAll();

            RoleEditGetModel model = new RoleEditGetModel();

            model.AllPerms  = allperms;
            model.Role      = role;
            model.RolePerms = rolePerms;
            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Edit(int id)
        {
            var role      = RoleService.GetById(id);
            var perms     = PermService.GetAll();
            var rolePerms = PermService.GetByRoleId(role.Id);

            RoleEditGetModel model = new RoleEditGetModel();

            model.Role        = role;
            model.RolePerm    = rolePerms;
            model.Permissions = perms;
            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult EditRole(long id)
        {
            RoleDTO roleDto = roleService.GetById(id);

            PermissionDTO[]  permissionDtos   = permService.GetByRoleId(id);
            PermissionDTO[]  permissionDtoAll = permService.GetAll();
            RoleEditGetModel roleEditGet      = new RoleEditGetModel();

            roleEditGet.PermissionDtoAll = permissionDtoAll;
            roleEditGet.PermissionDtoHas = permissionDtos;
            roleEditGet.RoleDto          = roleDto;
            return(View(roleEditGet));
        }
Exemplo n.º 6
0
        public ActionResult Edit(long id)
        {
            var role               = roleService.GetById(id);
            var permissions        = perService.GetAll();
            var hasPermissionIds   = perService.GetByRoleId(role.Id).Select(u => u.Id).ToArray();
            RoleEditGetModel model = new RoleEditGetModel
            {
                Role           = role,
                AllPermissions = permissions,
                PermissionIds  = hasPermissionIds
            };

            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult Edit(long id)
        {
            var role               = roleService.GetById(id);
            var rolePerms          = perService.GetByRoleId(id);
            var allPerms           = perService.GetAll();
            RoleEditGetModel model = new RoleEditGetModel
            {
                AllPerms  = allPerms,
                RolePerms = rolePerms,
                Role      = role,
            };

            return(View(model));
        }
Exemplo n.º 8
0
        public ActionResult Edit(long id)
        {
            var role     = roleService.GetById(id);
            var roleperm = permService.GetByRoleId(role.Id);
            var allPerms = permService.GetAll();

            //ViewBag.role = role;
            //ViewBag.roleperm = roleperm;
            RoleEditGetModel model = new RoleEditGetModel();

            model.role      = role;
            model.RolePerms = roleperm;
            model.AllPerms  = allPerms;
            return(View(model));
        }
Exemplo n.º 9
0
        public ActionResult Edit(long id)
        {
            //根据Id取得角色信息和角色拥有的权限
            var role = roleService.GetById(id);
            //这个角色拥有的权限
            var rolePerms = permService.GetByRoleId(id);
            //编辑的时候要把所有的权限也要列出来
            var allPerm = permService.GetAll();
            //给视图传数据,尽量不要用viewbag,就用Model
            //弱类型,动态对象,效率较低

            /*
             * ViewBag.role = role;
             * ViewBag.rolePerms = rolePerms;
             */
            RoleEditGetModel model = new RoleEditGetModel();

            model.AllPerms  = allPerm;
            model.Role      = role;
            model.RolePerms = rolePerms;
            return(View(model));
        }