private async Task <ProductLookups> SeedInitialProductMappings() { var cosmosContainer = await _cosmosDbClient.GetContainer <ProductLookups>(); var lookups = new ProductLookups() { Products = new List <ProductLookup>() { new ProductLookup() { ShopifySku = "50", FulfilmentSku = "HighWispyCloud" } // todo - any more products? }, UpdatedUtc = _dateTimeProvider.UtcNow, Id = Guid.NewGuid().ToString() }; var cosmosDbResponse = await cosmosContainer.Add(lookups.Id, lookups); if (!cosmosDbResponse.IsSuccessful) { throw new CosmosDbException($"Cosmos error product mappings {cosmosDbResponse.ErrorMessage}"); } return(lookups); }
public async Task SetProductLookups(ProductLookups lookups) { var cosmosContainer = await _cosmosDbClient.GetContainer <ProductLookups>(); lookups.Id = Guid.NewGuid().ToString(); lookups.UpdatedUtc = _dateTimeProvider.UtcNow; var cosmosDbResponse = await cosmosContainer.Add(lookups.Id, lookups); if (!cosmosDbResponse.IsSuccessful) { throw new CosmosDbException($"Cosmos error product mappings {cosmosDbResponse.ErrorMessage}"); } }