6 Replies
Create a class to model the request body and add it as a parameter with the
[FromBody]
attributeok, so this will work:
...
is that correct:
$tias
But also, you should be making a separate model for the request body
Don't use your database model
And you should also create a service class to encapsulate the logic of creating a city, and have your API endpoint call that service instead of using the database context itself
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.