Closed rajajhansi closed 9 years ago
'acceptChanges' returns the entity to an EntityState of 'Unchanged' by committing all changes made since the entity was last queried had 'acceptChanges' called on it. You don't want to call 'acceptChanges' prior to calling 'saveChanges' because there won't be any changes to save. Try changing the save method to this:
save() {
this.entityManager.saveChanges()
.then(() => Materialize.toast('Changes saved.', 2000));
}
@jdanyow, First of all, thank you so much for this wonderful aurelia breeze sample. I modified the settings.js to point to a local Northwind service endpoint (running as an ASP.NET Web API project). I added this.saveChanges() right after this.acceptChanges in entity-view-model.js as follows:
I also changed the copyEntityManager, which was returning an empty copy to return the actual entityManager as follows:
I think your comment
//fake save...
meant that just calling acceptChanges will only update the client cache of breeze but not the server. Even after adding saveChanges(), I don't see the call to saveChanges on my WebAPI in the network tab of my browser. Please let me know what do I miss to make it persist the changes via the WebAPI.