Just trying to get my head round the responsibilities of the service layer and repository layer when saving an object to my persistence store.
My current under standing is this:
In my controller I have created a "Note" object from the data submitted by the user (from the form). The user then calls "Save" on the "NoteService" (which is there via dependency injection).
Within the "Save" method on the "NoteService" I carry out my business logic validation and then pass the "Note" object to the "Save" method of the "NoteRepository".
The "Save" method of the "NoteRepository" then checks to see if there is an existing primary key on this object and if so then get's that object from the db and updates it's properties using the "Note" object passed through and it's then saved back to the db. If there is no primary key then the object is simply saved to the db and the then returned to the service with it's newly created primary key.