예제 #1
0
		public void ProductsQuantityUpdated()
		{
			var service = this.BigCommerceFactory.CreateProductsService( this.Config );

			var productToUpdate = new BigCommerceProduct { Id = 74, Quantity = "1" };
			service.UpdateProducts( new List< BigCommerceProduct > { productToUpdate } );
		}
예제 #2
0
		public async Task ProductsQuantityUpdatedAsync()
		{
			var service = this.BigCommerceFactory.CreateProductsService( this.Config );

			var productToUpdate = new BigCommerceProduct { Id = 74, Quantity = "6" };
			await service.UpdateProductsAsync( new List< BigCommerceProduct > { productToUpdate } );
		}
		private async Task UpdateProductQuantityAsync( BigCommerceProduct product )
		{
			var endpoint = ParamsBuilder.CreateProductUpdateEndpoint( product.Id );
			var jsonContent = new { inventory_level = product.Quantity }.ToJson();

			await ActionPolicies.SubmitAsync.Do( async () =>
			{
				await this._webRequestServices.PutDataAsync( BigCommerceCommand.UpdateProduct, endpoint, jsonContent );
				//API requirement
				this.CreateApiDelay().Wait();
			} );
		}