C
C#2y 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
Angius2y ago
In general, you should not be exposing your database models Don't receive them, don't send them Use DTOs
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Ernoi
Ernoi2y ago
Okay thanks for the help guys!
Accord
Accord2y ago
✅ This post has been marked as answered!