Пример #1
0
        /// <summary>
        /// 修改项目角色
        /// PC
        /// </summary>
        /// <param name="roleRequest"></param>
        /// <returns></returns>
        public bool ModifyRoles(RolesPostRequest roleRequest)
        {
            var dbRole = _roles.GetById(roleRequest.ID);

            dbRole.RoleName = roleRequest.RoleName;
            dbRole.Remark   = roleRequest.Remark;
            return(_roles.SaveChanges());
        }
Пример #2
0
        /// <summary>
        /// 添加项目角色
        /// PC
        /// </summary>
        /// <param name="roleRequest"></param>
        /// <returns></returns>
        public bool AddRoles(RolesPostRequest roleRequest)
        {
            var role = new Roles
            {
                Id           = Guid.NewGuid(),
                CreatedTime  = DateTime.Now,
                DeletedTime  = null,
                DeletedState = 0,
                RoleName     = roleRequest.RoleName,
                Remark       = roleRequest.Remark
            };

            _roles.PreInsert(role);
            return(_roles.SaveChanges());
        }
Пример #3
0
        public HttpResponseMessage edit_role(RolesPostRequest editRequest)
        {
            if (editRequest.ID == null)
            {
                return(toJson(null, OperatingState.CheckDataFail, "未传入需要的条件"));
            }
            //判断是否存在该角色名称
            if (_rolesService.GetRoleByName(editRequest.RoleName) != null)
            {
                return(toJson(null, OperatingState.CheckDataFail, "已经存在该角色"));
            }

            var result = _rolesService.ModifyRoles(editRequest);

            return(result ? toJson(null, OperatingState.Success, "操作成功") : toJson(null, OperatingState.Failure, "操作失败"));
        }
Пример #4
0
        /// <summary>
        /// 根据角色ID获取角色详情和所有权限
        /// </summary>
        /// <returns></returns>
        public RolesPostResponse GetRoleAndRoleRightsByRoleId(RolesPostRequest roleRequest)
        {
            //角色响应类
            var prpr = new RolesPostResponse();

            //获取角色详情
            var role = _roles.GetById(roleRequest.ID);

            prpr.RoleName    = role.RoleName;
            prpr.Remark      = role.Remark;
            prpr.CreatedTime = role.CreatedTime;

            //获取角色权限列表
            //var prrsList = _rolesRightsService.GetAllRoleRightsByRoleId(roleRequest.ID);
            //prpr.projectRoleRightList = prrsList.projectRoleRightList;

            return(prpr);
        }
Пример #5
0
 public HttpResponseMessage get_role_roleright_by_roleid(RolesPostRequest roleRequest)
 {
     return(toJson(_rolesService.GetRoleAndRoleRightsByRoleId(roleRequest)));
 }