Last active
November 2, 2020 12:15
-
-
Save PradeepLoganathan/3817b6b59d6b299c3e3d1bf36d333db2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task AddCustomer(Customer customer) | |
{ | |
try | |
{ | |
ItemResponse<Customer> customerResponse = await this._container.CreateItemAsync<Customer>(customer, new PartitionKey(customer.CustomerId)); | |
} | |
catch (CosmosException ex) | |
{ | |
Console.WriteLine("Exception occured in AddCustomer: Message body is {0}.\n", ex.Message); | |
throw; | |
} | |
} | |
public async Task AddOrders(List<Order> orders, string CustomerId) | |
{ | |
try | |
{ | |
foreach (var order in orders) | |
{ | |
ItemResponse<Order> orderResponse = await this._container.CreateItemAsync<Order>(order, new PartitionKey(CustomerId)); | |
} | |
} | |
catch (CosmosException ex) | |
{ | |
Console.WriteLine("Exception occured in AddCustomer: Message body is {0}.\n", ex.Message); | |
throw; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment