Example #1
0
        public ActionResult Update(int id)
        {
            var response = _userService.GetUser(new GetUserRequest {
                Id = id
            });
            var viewModel = response.MapTo <UpdateUserViewModel>();

            viewModel = UpdateViewModel(viewModel);
            viewModel.RolePrivilegeOption = _roleGroupService.GetRoleGroup(new Services.Requests.RoleGroup.GetRoleGroupRequest {
                Id = viewModel.RoleId
            }).Privileges.MapTo <SelectListItem>();
            return(View(viewModel));
        }
Example #2
0
        public string GetRoleGroupCode(int id)
        {
            var roleGroup = _roleGroupService.GetRoleGroup(new Services.Requests.RoleGroup.GetRoleGroupRequest {
                Id = id
            }).Code;

            return(roleGroup);
        }
Example #3
0
        public ActionResult GetRoleInfo()
        {
            //获取权限组的编号
            int RGid = Convert.ToInt32(Request["RGid"]);
            //获取指定权限组
            RoleGroup RGroup = RGroupService.GetRoleGroup(RGid);
            //获取指定权限组下的所有权限
            IEnumerable <int> roleList = contactService.GetRidByGid(RGid);

            return(Json(new { RGroup = RGroup, roleList = roleList }));
        }
Example #4
0
        public ActionResult Update(int id)
        {
            var response = _roleGroupService.GetRoleGroup(new GetRoleGroupRequest {
                Id = id
            });
            var viewModel = response.MapTo <UpdateRoleGroupViewModel>();

            viewModel = UpdateViewModel(viewModel);

            return(View(viewModel));
        }
Example #5
0
 public ActionResult EditRGroup(int?id)
 {
     ViewData["Roles"] = roleService.GetRoles();
     //新增
     if (id == null)
     {
         return(View());
     }
     //修改
     else
     {
         //获取指定权限组
         var RGroup = Mapper.Map <RoleGroupModel>(RGroupService.GetRoleGroup(Convert.ToInt32(id)));
         //获取指定权限组下的所有权限
         ViewData["RolesArr"] = contactService.GetRidByGid(Convert.ToInt32(id));
         return(View(RGroup));
     }
 }
Example #6
0
        public ActionResult GetPrivilege(int roleId)
        {
            List <SelectListItem> data = new List <SelectListItem>();

            if (roleId > 0)
            {
                var role = _roleGroupService.GetRoleGroup(new Services.Requests.RoleGroup.GetRoleGroupRequest {
                    Id = roleId
                });
                if (role.IsSuccess && role.Privileges != null)
                {
                    foreach (var privilege in role.Privileges)
                    {
                        data.Add(new SelectListItem
                        {
                            Text  = privilege.Name,
                            Value = privilege.Id.ToString()
                        });
                    }
                }
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }