public async Task <ActionResult> GetUserRoles(int userId) { try { var user = await _userService.GetAsync(userId); if (user == null) { return(NotFound("User not found")); } var roles = await _userRoleService.GetRolesAsyncBy(user); return(Ok(roles)); } catch (System.Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "A server error has occurred")); } }