Beispiel #1
0
        private static void InsertCustomers()
        {
            var customer = new Customer()
            {
                Name = "Anna1"
            };
            var customerSet = new Customer[]
            {
                new Customer {
                    Name = "Ivan1"
                },
                new Customer {
                    Name = "Pavel1"
                }
            };

            using (var context = new OnlineStoreContext())
            {
                //context.Customers.Add(customer);
                context.Add(customer);
                context.AddRange(customerSet);

                context.SaveChanges();
            }
        }
Beispiel #2
0
        private static void InsertProducts()
        {
            var bread = new Product()
            {
                Name = "Fan", Price = 1500
            };
            var liquid = new Product[]
            {
                new Product {
                    Name = "TV", Price = 30000
                },
                new Product {
                    Name = "Oven", Price = 10000
                }
            };

            using (var context = new OnlineStoreContext())
            {
                context.Products.Add(bread);

                context.AddRange(liquid);

                context.SaveChanges();
            }
        }
Beispiel #3
0
        private static void InsertCustomers()
        {
            var customer = new Customer {
                Name = "Alex"
            };
            var customerSet = new Customer[]
            {
                new Customer {
                    Name = "Tom"
                },
                new Customer {
                    Name = "John"
                }
            };

            using (var context = new OnlineStoreContext())
            {
                context.Customers.Add(customer);
                context.AddRange(customerSet);
                context.SaveChanges();
            }
        }
Beispiel #4
0
        private static void InsertProducts()
        {
            var product = new Product {
                Name = "iPhone XsMax", Price = 119990
            };
            var products = new Product[]
            {
                new Product {
                    Name = "Samsung A8", Price = 69990
                },
                new Product {
                    Name = "Sony XperiaZ", Price = 59990
                }
            };

            using (var context = new OnlineStoreContext())
            {
                context.Add(product);
                context.AddRange(products);
                context.SaveChanges();
            }
        }
Beispiel #5
0
        private static void InsertProduct()
        {
            var product = new Product {
                Name = "apple", Price = 30
            };

            var productSet = new Product[]
            {
                new Product {
                    Name = "tomato", Price = 25
                },
                new Product {
                    Name = "orange", Price = 65
                }
            };

            using (var context = new OnlineStoreContext())
            {
                context.Add(product);
                context.AddRange(productSet);
                context.SaveChanges();
            }
        }
Beispiel #6
0
        private static void InsertProduct()
        {
            var product = new Product {
                Name = "Ryazenka", Price = 5
            };
            var products = new Product[]
            {
                new Product {
                    Name = "kefir", Price = 4
                },
                new Product {
                    Name = "Yogurt", Price = 5
                }
            };

            using (var context = new OnlineStoreContext())
            {
                context.Products.Add(product);

                context.AddRange(products);
                context.SaveChanges();
            }
        }