public async Task UpdateAsync(RoleUDto dto) { var role = await _roleManager.FindByIdAsync(dto.Id.ToString()); role.Name = dto.Name; role.Description = dto.Description; var result = await _roleManager.UpdateAsync(role); if (!result.Succeeded) { var errors = result.Errors.Select(b => b.Description).Aggregate((i, next) => $"{i},{next}"); _logger.LogError($"更新角色信息出错:{dto.Id}, {errors}"); throw new UserOperationException($"{errors}"); } }
public async Task <IActionResult> UpdateAsync([FromBody] RoleUDto dto) { await _roleService.UpdateAsync(dto); return(Ok()); }