I have a view model that consists of the following three fields:
- StartDate
- EndData
- Status
The StartDate
and the EndDate
fields are stored in db and can be edited on UI. The Status
field is computed on the server side and is read-only (it depends from the two dates, but this logic can be changed).
When I change the dates on the client side and send a PUT request, I want the Status
to be updated on my page as well. I see couple of options how this might be implemented:
Update the status immediately on the client. That does not look pretty right to me since I need to duplicate the status determining logic which is already part of the domain model.
Re-read the model manually using a GET request after the updating. This can happen for instance if I receive the
205 Reset Content
response.Return the new status or the whole model in the response of the PUT request. Might be an option but as far as I see it's recommended to return either
200 OK
or204 No Content
status.