public async Task Exercise_11_1_Get_Products() { //create a new product resource var productResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.ProductResource(_apiContext); //Get products var products = productResource.GetProductsAsync(startIndex: 0, pageSize: 200).Result; //Add Your Code: //Write total number of products to output window System.Diagnostics.Debug.WriteLine("Total Products: {0}", products.TotalCount); //Add Your Code: //Get all products that have options and are configurable var configurableProducts = products.Items.Where(d => d.Options != null).ToList(); //Add Your Code: //Write total number of configurable products to output window System.Diagnostics.Debug.WriteLine("Total Configurable Products: {0}", configurableProducts.Count); //Add Your Code: //Get all products that do not have options and are not configurable var nonConfigurableProducts = products.Items.Where(d => d.Options == null).ToList(); //Add Your Code: //Write total number of non-configurable products to output window System.Diagnostics.Debug.WriteLine("Total Non-Configurable Products: {0}", nonConfigurableProducts.Count); //Add Your Code: //Get all products that are scarfs var scarfProducts = products.Items.Where(d => d.Content.ProductName.ToLower().Contains("scarf")).ToList(); //Add Your Code: //Write total number of scarf products to output window System.Diagnostics.Debug.WriteLine("Total Scarf Products: {0}", scarfProducts.Count); //Add Your Code: //Get product price var purseProduct = productResource.GetProductAsync("LUC-BAG-007").Result; //Add Your Code: //Write product prices to output window System.Diagnostics.Debug.WriteLine("Product Prices[{0}]: Price({1}) Sales Price({2})", purseProduct.ProductCode, purseProduct.Price.Price.GetValueOrDefault().ToString("C"), purseProduct.Price.SalePrice); //Create a new location inventory resource var inventoryResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.LocationInventoryResource(_apiContext); //Add Your Code: //Get inventory var inventory = inventoryResource.GetLocationInventoryAsync("WRH01", "LUC-BAG-007").Result; //Demostrate utility methods var allProducts = await GetAllProducts(productResource); }
public void Exercise_11_3_Add_Inventory_For_Product() { //Create a new location inventory resource var inventoryResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.LocationInventoryResource(_apiContext); //Retrieve inventory from main warehouse var inventory = inventoryResource.GetLocationInventoryAsync("WRH01", "LUC-BAG-010").Result; var locationInventoryList = new List <Mozu.Api.Contracts.ProductAdmin.LocationInventory>() { new Mozu.Api.Contracts.ProductAdmin.LocationInventory() { LocationCode = "WRH01", //Use the ProductVariation ProductCode here ProductCode = "LUC-BAG-010-PET", StockOnHand = 90 } }; //Add inventory for product in location var newInventory = inventoryResource.AddLocationInventoryAsync(locationInventoryList, "WRH01", true).Result; }
public void Exercise_11_3_Add_Inventory_For_Product() { //Create a new location inventory resource var inventoryResource = new Mozu.Api.Resources.Commerce.Catalog.Admin.LocationInventoryResource(_apiContext); //Retrieve inventory from main warehouse var inventory = inventoryResource.GetLocationInventoryAsync("WRH01", "LUC-BAG-010").Result; var locationInventoryList = new List<Mozu.Api.Contracts.ProductAdmin.LocationInventory>() { new Mozu.Api.Contracts.ProductAdmin.LocationInventory() { LocationCode = "WRH01", //Use the ProductVariation ProductCode here ProductCode = "LUC-BAG-010-PET", StockOnHand = 90 } }; //Add inventory for product in location var newInventory = inventoryResource.AddLocationInventoryAsync(locationInventoryList, "WRH01", true).Result; }