public bool UpdateRecord <T>(string id, T record) where T : ZohoEntity { AssertTypeIsNotAbstract(typeof(T)); AssertAllowInserts(typeof(T)); var collection = new ZohoEntityCollection <T> { record }; var moduleName = ModuleName(typeof(T)); var xmlData = collection.ToXmlString(); var response = PostData(moduleName, "updateRecords", new Dictionary <string, string> { { "id", id } }, xmlData); if (response.RecordDetails.Count() != 1) { throw new InvalidOperationException("Invalid number of details returned"); } var detail = response.RecordDetails.First(); return(detail.Id == id); }
public ZohoBulkUpsertRepsonse <T> BulkUpsertRecords <T>(IList <T> records) where T : ZohoEntity { AssertTypeIsNotAbstract(typeof(T)); AssertAllowInserts(typeof(T)); AssertAllowMultipleInserts(typeof(T), records); var collection = new ZohoEntityCollection <T>(); foreach (var record in records) { collection.Add(record); } var moduleName = ModuleName(records.FirstOrDefault()); var xmlData = collection.ToXmlString(); this.DuplicateCheck = InsertDuplicateCheck.Update; var rawHtmlRepsonse = PostDataRaw(moduleName, "insertRecords", null, xmlData, 4, true); var response = new ZohoBulkUpsertRepsonse <T>(rawHtmlRepsonse, requestItems: records.ToList()); return(response); }