/// <summary> /// Deletes an existing product. /// </summary> /// <param name="entry">the entry to delete</param> public void Delete(ProductEntry entry) { base.Delete(entry); }
private static void RunSample(string username, string password, string accountId) { // Connect to the service ContentForShoppingService service = new ContentForShoppingService("ContentForShopping-Sample"); service.setUserCredentials(username, password); // Retrieve the list of all existing products string projection = "schema"; ProductQuery query = new ProductQuery(projection, accountId); ProductFeed feed = service.Query(query); // Display title and id for each product Console.WriteLine("Listing all products"); foreach (ProductEntry p in feed.Entries) { Console.WriteLine("Product: " + p.Title.Text + " (" + p.ProductId + ")"); } // Create a new product ProductEntry entry = new ProductEntry(); entry.Title.Text = "Wool sweater"; AtomContent c = new AtomContent(); c.Content = "Comfortable and soft, this sweater will keep you warm on those cold winter nights. Red and blue stripes."; entry.Content = c; entry.ProductId = "123457"; entry.Language = "it"; entry.TargetCountry = "US"; entry.ContentLanguage = "en"; entry.Brand = "ACME"; entry.Condition = "new"; entry.Price = new Price("usd", "25"); entry.ProductType = "Clothing & Accessories > Clothing > Outerwear > Sweaters"; entry.Quantity = 3; entry.ShippingWeight = new ShippingWeight("lb", "0.1"); entry.ImageLink = new ImageLink("http://www.example.com/image.jpg"); entry.Availability = "available for order"; entry.Channel = "online"; entry.Gender = "female"; entry.Material = "wool"; entry.Pattern = "Red and blue stripes"; entry.Color = "red"; AtomLink link = new AtomLink(); link.HRef = "http://www.example.com"; link.Rel = "alternate"; link.Type = "text/html"; entry.Links.Add(link); // Shipping rules Shipping s1 = new Shipping(); s1.Country = "US"; s1.Region = "MA"; s1.Service = "Speedy Shipping - Ground"; s1.Price = new ShippingPrice("usd", "5.95"); Shipping s2 = new Shipping(); s2.Country = "US"; s2.Region = "024*"; s2.Service = "Speedy Shipping - Air"; s2.Price = new ShippingPrice("usd", "7.95"); entry.ShippingRules.Add(s1); entry.ShippingRules.Add(s2); // Tax rules Tax t1 = new Tax(); t1.Country = "US"; t1.Region = "CA"; t1.Rate = "8.25"; t1.Ship = true; Tax t2 = new Tax(); t2.Country = "US"; t2.Region = "926*"; t2.Rate = "8.75"; t2.Ship = false; entry.TaxRules.Add(t1); entry.TaxRules.Add(t2); // Additional Image Links AdditionalImageLink il1 = new AdditionalImageLink("http://www.example.com/1.jpg"); entry.AdditionalImageLinks.Add(il1); AdditionalImageLink il2 = new AdditionalImageLink("http://www.example.com/2.jpg"); entry.AdditionalImageLinks.Add(il2); // Add the product to the server feed Console.WriteLine("Inserting product"); ProductEntry inserted = service.Insert(feed, entry); // Update the product we just inserted inserted.Title.Text = "2011 Wool sweater"; Console.WriteLine("Updating product"); ProductEntry updated = service.Update(inserted); // Retrieve the new list of products feed = service.Query(query); // Display title and id for each product Console.WriteLine("Listing all products again"); foreach (ProductEntry p in feed.Entries) { Console.WriteLine("Product: " + p.Title.Text + " (" + p.ProductId + ")"); } // Delete the item we inserted and updated Console.WriteLine("Deleting product"); service.Delete(updated); }
/// <summary> /// Inserts a new product entry into the specified feed. /// </summary> /// <param name="feed">the feed into which this entry should be inserted</param> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public ProductEntry Insert(ProductFeed feed, ProductEntry entry) { return base.Insert(feed, entry); }
/// <summary> /// Updates an existing product entry with the new values /// </summary> /// <param name="entry">the entry to insert</param> /// <returns>the updated entry returned by the server</returns> public ProductEntry Update(ProductEntry entry) { return base.Update(entry); }
/// <summary> /// Inserts a new product entry. /// </summary> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public ProductEntry Insert(ProductEntry entry) { return base.Insert(CreateUri("items/products", null), entry) as ProductEntry; }
/// <summary> /// Inserts a new product entry. /// </summary> /// <param name="entry">the entry to insert</param> /// <param name="accountId">The account ID of the user.</param> /// <param name="projection">a projection determining response values /// <returns>the inserted entry</returns> public ProductEntry Insert(ProductEntry entry, string accountId, string projection) { return base.Insert(CreateUri(accountId, "items/products", projection, null), entry); }
/// <summary> /// Updates an existing product entry with the new values /// </summary> /// <param name="entry">the entry to insert</param> /// <returns>the updated entry returned by the server</returns> public ProductEntry Update(ProductEntry entry) { return(base.Update(entry)); }
/// <summary> /// Inserts a new product entry into the specified feed. /// </summary> /// <param name="feed">the feed into which this entry should be inserted</param> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public ProductEntry Insert(ProductFeed feed, ProductEntry entry) { return(base.Insert(feed, entry)); }
/// <summary> /// Inserts a new product entry. /// </summary> /// <param name="entry">the entry to insert</param> /// <param name="accountId">The account ID of the user.</param> /// <param name="projection">a projection determining response values /// <returns>the inserted entry</returns> public ProductEntry Insert(ProductEntry entry, string accountId, string projection) { return(base.Insert(CreateUri(accountId, "items/products", projection, null), entry)); }
/// <summary> /// Inserts a new product entry. /// </summary> /// <param name="entry">the entry to insert</param> /// <returns>the inserted entry</returns> public ProductEntry Insert(ProductEntry entry) { return(base.Insert(CreateUri("items/products", null), entry) as ProductEntry); }