I'd like to create routings like below
[HttpPost("device/{id}/disable")]
[HttpPost("device/{id}/enable")]
public async Task SetDevice(stirng id, bool state)
And when the user hit the "device/{id}/disable", the state var will automatically assigned with false, and vise versa. How can I achieve that? Thanks
You have two options or maybe more:
Use route names:
If you want to know how to get the route name in your action or razor view see get current route name.
Or use default route values: