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(); }
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); } }