It seems perfectly true if we have an API controller with a method like below:
[HttpPost]
public IHttpActionResult DoStuff([FromBody]ModelA modelA, [FromBody]ModelB modelB)
Pay attention to two attributes [FromBody].
The question is how to call such a method?
localhost/test/DoStuff/
POST data:
<?xml version="1.0"?>
<ModelA>
...
</ModelA>
<ModelB>
...
</ModelB>
does not seem to be recognized. Any ideas why?
EDIT: The error data is as follows:
<?xml version="1.0"?>
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>Can't bind multiple parameters ('model1' and 'model2') to the request content.
</ExceptionMessage>
</Error>
source
share