I have a bulk insert screen which allows the user to insert products line by line.. Each product has it's own Units of measurement.
Here is my save changes Code:
save = function (product) {
var entitiesToSave = product.units().slice();
entitiesToSave.push(product);
var so = new breeze.SaveOptions({ allowConcurrentSaves: true })
return manager.saveChanges([entitiesToSave],so)
.then(saveSucceeded)
.fail(saveFailed);
}
Once I try to save; I get this message:
The 'entities' parameter is optional or it must be an array where each element must be an entity
Modifying the code to:
save = function (product) {
var so = new breeze.SaveOptions({ allowConcurrentSaves: true })
return manager.saveChanges([product,product.units()[0]],so)
.then(saveSucceeded)
.fail(saveFailed);
}
Works fine for one product unit.. However, I needed to save a specific product with all of it's units in one shot.. Any help is appreciated.