C
C#3y ago
Ernoi

Best pratice for REST-api [Answered]

I have the usual CRUD operations. I'm curious about how to do with put. I can send a id in the request body but it does not take affect in the repository cause the database will just increment the id and create a new one. So im wondering if i should have another model that that does not have the id attribute and use that one in the api instead?
4 Replies
Angius
Angius3y ago
In general, you should not be exposing your database models Don't receive them, don't send them Use DTOs
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Ernoi
ErnoiOP3y ago
Okay thanks for the help guys!
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server