I am trying to create a Put endpoint using rest. Let's say that under the link
I am trying to add a new address (if that id doesn't exist) or I'm trying to update it if it does already exist.
My application has several layers Controllers, Services, Models and Repositories. Given the fact that the business layer decides if an update or an add is required (this logic takes place in the service layer and below), how would the controllers be able to find out if an update or an add happened and return the correct status codes (201 for resource created, 204 if just an update has occured)?
My only ideas are to return some sort of result object, but that doesn't feel particularly correct. For the cases where the service methods are not void, they usually return DTOs.