I'm trying to have two action methods on an API controller with the same [Route] name, but different parameter types. One which takes a particular object, and the other which takes an array of that object type.
The model binder doesn't seem to be able to distinguish between these and I get the following error returned:
Multiple actions were found that match the request
Is there any way of having two POST methods with the same route but different parameter types?
You can't have 2 actions with same routing and same http verb (like Post). And I think that it's beter to use different routings for this example:
/api/controllerName/PostType
/api/controllerName/PostListType
it will be more readible and esier to mantain in future. And when someone else will create client app routing will be self explanatory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With