void Update(string updatedName, SpCustomerApi.CustomerSummary existingCustomer) { existingCustomer.Name = updatedName; IRestResponse response = Retry(() => _customerApi.PutCustomer(existingCustomer._links.self.href, existingCustomer)); if (response.StatusCode != HttpStatusCode.Accepted) { throw new Exception(string.Format("Customer: {0} failed to update with status code {1}", existingCustomer.ExternalId, response.StatusCode)); } }
void Create(string externalId, string name) { var newCustomer = new SpCustomerApi.CustomerSummary { ExternalId = externalId, Name = name, RequestId = Guid.NewGuid() }; IRestResponse response = Retry(() => _customerApi.CreateCustomer(newCustomer)); if (response.StatusCode != HttpStatusCode.Accepted) { throw new Exception(string.Format("Customer: {0} failed to create with status code {1}", externalId, response.StatusCode)); } }