Beispiel #1
0
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any products.
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "Name1",
                Description = "d1",
                Category    = "c1",
                Price       = 50.0
            },
                new Product
            {
                Name        = "Name2",
                Description = "d2",
                Category    = "c2",
                Price       = 20.0
            }
                );
            context.SaveChanges();
        }
Beispiel #2
0
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any products.
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "Apa",
                Description = "Plata",
                Category    = "Sticla",
                Price       = 10
            },
                new Product
            {
                Name        = "Laptop",
                Description = "Asus",
                Category    = "Electronice",
                Price       = 500
            }
                );
            context.SaveChanges();
        }
Beispiel #3
0
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any products.
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "iPhone",
                Description = "XS",
                Cathegory   = "Phone",
                Price       = 500
            },
                new Product
            {
                Name        = "Samsung",
                Description = "Galaxy",
                Cathegory   = "Phone",
                Price       = 400
            }
                );
            context.SaveChanges();
        }
Beispiel #4
0
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any products.
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "Milka",
                Description = "Milk",
                Category    = "Chocolate",
                Price       = 15
            },
                new Product
            {
                Name        = "Kinder",
                Description = "Bueno",
                Category    = "Chocolate",
                Price       = 12
            }
                );
            context.SaveChanges();
        }
Beispiel #5
0
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any products.
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "Masina",
                Description = "Family",
                Category    = "Sport",
                Price       = 100.5
            },
                new Product
            {
                Name        = "Telefon",
                Description = "Smart",
                Category    = "Small",
                Price       = 200.5
            }
                );
            context.SaveChanges();
        }
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any flowers.
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "Cars",
                Description = "Toy RC",
                Category    = "children",
                Price       = 12.5
            },
                new Product
            {
                Name        = "bout",
                Description = "Toy RC",
                Category    = "children",
                Price       = 23.9
            }
                );
            context.SaveChanges();
        }
Beispiel #7
0
        public static void Initialize(ProductsDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any product
            if (context.Products.Any())
            {
                return;   // DB has been seeded
            }

            context.Products.AddRange(
                new Product
            {
                Name        = "Huawei P10Lite",
                Description = "White",
                Category    = "Huawei",
                Price       = 5.00
            }

                );
            context.SaveChanges();
        }