Ad

Cant Pass Url Param To Objcet Using [FromRoute] In APS.NET Core

- 1 answer

I learn ASP.NET Core and have this React app that works ok except for that I can make a Crud call to the ASP.NET Controller but the url query string cant be mapped to Object using the [FromRoute]

I think I do something wrong, Please advice looking at the picture:

enter image description here

Ad

Answer

[FromRoute] Means you'll attempt to get it from the route, not the query /{title}/{author}/{genre}/{price}.

You have to use [FromQuery] to get the data from query: ?title=aa&author=bb...

Ad
source: stackoverflow.com
Ad