Beispiel #1
0
 // Get an entire entity set.
 static void ListAllProducts(Default.Container container)
 {
     foreach (var p in container.Products)
     {
         Console.WriteLine("{0} {1} {2}", p.Name, p.Price, p.Category);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            // TODO: Replace with your local URI.
            string serviceUri = "http://localhost:58374/";
            var    container  = new Default.Container(new Uri(serviceUri));
            //Lisää uuden tietokantaan, aina kun ohjelma ajetaan
            var product = new ProductService.Models.Product()
            {
                Name     = "Yo-yo",
                Category = "Toys",
                Price    = 4.95M
            };
            var product2 = new ProductService.Models.Product()
            {
                Name     = "Car",
                Category = "Toys",
                Price    = 2.50M
            };

            var supplier = new ProductService.Models.Supplier()
            {
                Id   = 12,
                Name = "Lelutehdas Oy"
            };

            AddProduct(container, product);
            AddProduct(container, product2);
            AddSupplier(container, supplier);
            ListAllProducts(container);
            Console.ReadLine();
        }
Beispiel #3
0
 // Get an entire entity set.
 static void ListAllProducts(Default.Container container)
 {
     foreach (var p in container.Products)
     {
         System.Diagnostics.Debug.WriteLine("{0} {1} {2}", p.Name, p.Price, p.Category);
         //Console.WriteLine("{0} {1} {2}", p.Name, p.Price, p.Category);
     }
 }
Beispiel #4
0
        static void AddSupplier(Default.Container container, ProductService.Models.Supplier supplier)
        {
            container.AddToSuppliers(supplier);
            var serviceResponse = container.SaveChanges();

            foreach (var operationResponse in serviceResponse)
            {
                Console.WriteLine("Response: {0}", operationResponse.StatusCode);
            }
        }
Beispiel #5
0
        static void AddProduct(Default.Container container, ProductService.Models.Product product)
        {
            container.AddToProducts(product);
            var serviceResponse = container.SaveChanges();

            foreach (var operationResponse in serviceResponse)
            {
                Console.WriteLine("Response: {0}", operationResponse.StatusCode);
            }
        }
Beispiel #6
0
        static void AddProduct(Default.Container container, ODataTest2017.Models.Product product)
        {
            container.AddToProducts(product);
            var serviceResponse = container.SaveChanges();

            foreach (var operationResponse in serviceResponse)
            {
                System.Diagnostics.Debug.WriteLine("Response: {0}", operationResponse.StatusCode);
                //Console.WriteLine("Response: {0}", operationResponse.StatusCode);
            }
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            string serviceUri = "50927";
            var    container  = new Default.Container(new Uri(serviceUri));

            var product = new ODataTest2017.Models.Product()
            {
                Name     = "Yo-yo",
                Category = "Toys",
                Price    = 4.95M
            };

            AddProduct(container, product);
            ListAllProducts(container);
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            // TODO: Replace with your local URI.
            string serviceUri = "http://localhost:port/";
            var    container  = new Default.Container(new Uri(serviceUri));

            var product = new ProductService.Models.Product()
            {
                Name     = "Yo-yo",
                Category = "Toys",
                Price    = 4.95M
            };

            AddProduct(container, product);
            ListAllProducts(container);
        }
Beispiel #9
0
        static void Main(string[] args)
        {
            string serviceUrl = "http://localhost:2029";
            var    container  = new Default.Container(new Uri(serviceUrl));

            var product = new ProductService.Models.Product()
            {
                Name     = "Yo-yo",
                Category = "Toy",
                Price    = 4.95M
            };

            //AddProduct(container, product);

            ListAllProducts(container);

            Console.ReadLine();
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            // TODO: Replace with your local URI.
            string serviceUri = "http://localhost:57191/";
            var    container  = new Default.Container(new Uri(serviceUri));

            var product = new ODataService.Models.Product()
            {
                Name = "Dave",
                ID   = 12
            };

            AddProduct(container, product);

            ListAllProducts(container);

            Console.WriteLine("Done");

            Console.ReadLine();
        }