I have the action ReportSsrs
of a AffairesController
public async Task<IActionResult> ReportSsrs(
int affaireId,
int[] coucheIds = null,
int[] secteurIds = null)
{
return ...
}
I want to send an affair id and two arrays of ids couche
and secteur
I try to use the following URL
//localhost:5001/affaires/reportssrs?affaireId=9&coucheIds[]=10§eurIds[]=23
however what I get when I put a breakpoint and the action is hit, it does not seem to pass very well, the array value:
What is the correct way to pass an array via the URL to the action?
CodePudding user response:
The correct url should be:
localhost:5001/affaires/reportssrs?affaireId=9&coucheIds=10§eurIds=10
If your array contains more than one item, the url should be:
[...]/reportssrs?affaireId=9&coucheIds=10&coucheIds=11§eurIds=10§eurIds=12