소스 검색

Merge branch 'master' of http://110.188.24.182:10023/Fengwo/hotline

田爽 1 년 전
부모
커밋
782cfc015b
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      src/Hotline.Api/Controllers/RoleController.cs

+ 4 - 1
src/Hotline.Api/Controllers/RoleController.cs

@@ -136,7 +136,10 @@ public class RoleController : BaseController
     [HttpPut]
     public async Task Update([FromBody] UpdateRoleDto dto)
     {
-        await _roleRepository.UpdateAsync(_mapper.Map<Role>(dto), HttpContext.RequestAborted);
+        var role = await _roleRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
+        if (role == null) throw new UserFriendlyException("无效角色编号");
+        _mapper.Map(dto, role);
+        await _roleRepository.UpdateAsync(role, HttpContext.RequestAborted);
     }
 
     #region 应用权限管理