For a project we have a class called Item
.
This Item
has an ID
, Title
, Description
and MediaFile[]
. Now, we have an edit function in which we can change the title, description and add/remove MediaFile
. Adding a MediaFile
is done by posting a file to the backend, which returns a Filename
and Id
.
When we want to PUT the changed Item
, our backend wants to have a different model, only containing the ID
, Title
, Description
and an array containing MediaFile id's Guid[]
. This demands an extra "conversion" in our frontend from MediaFile[]
to Guid[]
. Doesn't it make more sense to send the complete, updated Item
as we got it with a GET in the first place?
In short: For collections in a class, should you send the complete array of classes or an array containing only id's of the classes?