/// <summary> /// Example showing how to save multiple items of the same model at a time. /// </summary> /// <param name="serviceOrderItemsModel1">This contains a standard ServiceOrderItemsModel object. A partial model mith missing properties is allowed.</param> /// <param name="bulkOperation1">Contains "create" or "update"</param> /// <param name="serviceOrderItemsModel2">This contains a standard ServiceOrderItemsModel object. A partial model mith missing properties is allowed.</param> /// <param name="bulkOperation2">Contains "create" or "update"</param> /// <param name="continueOnError">The bulk process is transactional and will save nothing if an item errors. If you are submitting a list of unrelated items to save, set this as false and the bulk save process will attempt to continue saving if an item fails to save. Note that certain errors will always result in the bulk operation halting.</param> /// <returns></returns> public BulkResponseModel Bulk(ServiceOrderItemsModel serviceOrderItemsModel1, string bulkOperation1, ServiceOrderItemsModel serviceOrderItemsModel2, string bulkOperation2, bool continueOnError) { /* If one item fails, you have the option to continue without it (see BulkRequestModel.ContinueOnError). Use this for large updates of unrelated items. * -You can track items via the BulkItemIndex tracker.*/ var myBulkRequest = new BulkRequestModel { ContinueOnError = continueOnError }; var mybulkRequestItem = new BulkRequestItem() { UngerboeckModel = serviceOrderItemsModel1, //This is a standard Ungerboeck Model found in our SDK Action = bulkOperation1, //contains "create" or "update". Every item action can be independent. BulkItemIndex = 1 //Use this index to track items in the response. Whether an item succeeds or fails, it will preserve the index you assign it. }; myBulkRequest.BulkRequestItems.Add(mybulkRequestItem); mybulkRequestItem = new BulkRequestItem() { UngerboeckModel = serviceOrderItemsModel2, Action = bulkOperation2, BulkItemIndex = 2 }; myBulkRequest.BulkRequestItems.Add(mybulkRequestItem); return(APIUtil.DoBulk <ServiceOrderItemsModel>(USISDKClient, myBulkRequest)); }
/// <summary> /// Example showing how to save multiple items of the same model at a time. /// </summary> /// <param name="ExternalDetailsModel1">This contains a standard ExternalDetailsModel object. A partial model mith missing properties is allowed.</param> /// <param name="bulkOperation1">Contains "create" or "update"</param> /// <param name="ExternalDetailsModel2">This contains a standard ExternalDetailsModel object. A partial model mith missing properties is allowed.</param> /// <param name="bulkOperation2">Contains "create" or "update"</param> /// <param name="continueOnError">The bulk process is transactional and will save nothing if an item errors. If you are submitting a list of unrelated items to save, set this as false and the bulk save process will attempt to continue saving if an item fails to save. Note that certain errors will always result in the bulk operation halting.</param> /// <returns></returns> public BulkResponseModel Bulk(ExternalDetailsModel ExternalDetailsModel1, string bulkOperation1, ExternalDetailsModel ExternalDetailsModel2, string bulkOperation2, bool continueOnError, bool skipExternalDetailConflicts) { /* If one item fails, you have the option to continue without it (see BulkRequestModel.ContinueOnError). Use this for large updates of unrelated items. * -You can track items via the BulkItemIndex tracker.*/ var myBulkRequest = new BulkRequestModel { ContinueOnError = continueOnError }; var mybulkRequestItem = new BulkRequestItem() { UngerboeckModel = ExternalDetailsModel1, //This is a standard Ungerboeck Model found in our SDK Action = bulkOperation1, //contains "create" or "update". Every item action can be independent. BulkItemIndex = 1 //Use this index to track items in the response. Whether an item succeeds or fails, it will preserve the index you assign it. }; myBulkRequest.BulkRequestItems.Add(mybulkRequestItem); mybulkRequestItem = new BulkRequestItem() { UngerboeckModel = ExternalDetailsModel2, Action = bulkOperation2, BulkItemIndex = 2 }; myBulkRequest.BulkRequestItems.Add(mybulkRequestItem); if (skipExternalDetailConflicts) { //Use this header to skip ExternalDetail conflicts if (!USISDKClient.DefaultRequestHeaders.Contains("X-ValidationOverrides")) { USISDKClient.DefaultRequestHeaders.Add("X-ValidationOverrides", "[{\"Code\": 12015}]"); } } return(APIUtil.DoBulk <ExternalDetailsModel>(USISDKClient, myBulkRequest)); }