public UpdateCollectionRequestData GetInsertCollectionRequest(IIdoCommandBuilder builder) { var request = new UpdateCollectionRequestData() { IDOName = builder.IdoName, RefreshAfterUpdate = true, }; foreach (IIdoCommandBuilder child in builder.GetChildren()) child.Action(UpdateAction.Insert); request.Items.Add(getInsertItem(builder)); return request; }
private IDOUpdateItem getInsertItem(IIdoCommandBuilder builder) { var item = new IDOUpdateItem(UpdateAction.Insert); var propertyKeys = builder.Properties.Keys; propertyKeys.ForEach(key => item.Properties.Add(key, builder.Properties[key])); builder.GetChildren().ForEach(child => { item.NestedUpdates.Add(getNestedInsert(child)); }); return item; }
private IDOUpdateItem getUpdateItem(IIdoCommandBuilder builder, UpdateAction action, IdoItemWrapper idoItemWrapper) { var item = new IDOUpdateItem(action); item.Action = GetUpdateActionFromBuilder(builder); item.ItemID = idoItemWrapper[IdoConstants.KEY].ToString(); var propertyKeys = builder.Properties.Keys; propertyKeys.ForEach(key => item.Properties.Add(key, builder.Properties[key])); builder.GetChildren().ForEach(child => { var updateCollectionRequestData = new List<UpdateCollectionRequestData>(); idoItemWrapper.Records.Where(record => record.IdoName == child.IdoName) .ForEach(record => updateCollectionRequestData.Add(getNestedUpdate(child, record))); updateCollectionRequestData.ForEach(request => item.NestedUpdates.Add(request)); }); return item; }