Example #1
0
        private void DeleteProduct()
        {
            Console.WriteLine("Delete Product");
            Container c       = Container.New();
            var       product = c.Products.Where(p => p.ID == _lastIndex).Single();

            c.DeleteObject(product);
            c.SaveChanges();
            Console.WriteLine("\t{0} was deleted", product.Name);
            GetProducts();
        }
Example #2
0
        private void PatchProduct()
        {
            Console.WriteLine("Patch Product");
            Container c       = Container.New();
            var       product = c.Products.Where(p => p.ID == _lastIndex).Single();

            product.ReleaseDate = new DateTime(2012, 10, 26);
            c.UpdateObject(product);
            c.SaveChanges();
            Console.WriteLine("\t{0}'s release date is changed to {1}", product.Name, product.ReleaseDate);
            GetProducts();
        }
Example #3
0
        private void LinkProductToFamily()
        {
            Console.WriteLine("Link Product to Family");
            Container c       = Container.New();
            var       product = c.Products.Where(p => p.ID == _lastIndex).Single();
            var       family  = c.ProductFamilies.Where(p => p.Name.Contains("Windows")).Single();

            c.SetLink(product, "Family", family);
            c.SaveChanges();

            Console.WriteLine("\t{0} was linked to {0} family", product.Name, family.Name);
            GetProducts();
        }
Example #4
0
        private void PostProduct()
        {
            Console.WriteLine("Post Product");
            Container c       = Container.New();
            Product   product = new Product {
                Name = "Windows 8"
            };

            c.AddToProducts(product);
            c.SaveChanges();
            Console.WriteLine("\t{0} was added", product.Name);
            GetProducts();
        }