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