Can I have both FromForm and FromBody attributes to action ?
public IActionResult Index([FromBody][FromForm] Person model){
.....
}
No, it's not possible.
The FromForm
attribute is for incoming data from a submitted form sent by the content type application/x-www-url-formencoded
while the FromBody
will parse the model the default way, which in most cases are sent by the content type application/json
, from the request body.