There's a few issues I can see with this code.
The repositories are are sitting in the presentation layer. A big no no. It's software 101, don't place data access in your presentation layer, and not good to put business logic in the presentation layer.
Those _roleRepository calls need to go in to a RoleRetrievalService or something similar. That centralise the business logic.
Your repositories should to sit behind a service layer which handles all of the calls to the DAL. Your service layer should contain business logic and data transformation which turns those DAL entities in to models which can be consumed by the presentation layer.
The query which does the left join should go in the service layer with the parameters required to execute the query being passed in as parameters. You could also pass in the sort options as well.
That last statement which builds the results (jsonData) is exactly what should be produced by your service layer.
It all hinges one how much time you have and how much technical debt you want to incur :)