示例#1
0
        public static void Seed(IApplicationBuilder applicationBuilder)
        {
            AppDbContext context =
                applicationBuilder.ApplicationServices.GetRequiredService <AppDbContext>();

            if (!context.ProductSorters.Any())
            {
                context.ProductSorters.AddRange(ProductSorters.Select(c => c.Value));
            }
            if (!context.UsersData.Any())
            {
                context.AddRange
                (
                    new User
                {
                    FirstName       = "Domagoj",
                    LastName        = "Krajnovic",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = true,
                    IsEmailVerified = true
                },
                    new User
                {
                    FirstName       = "Pero",
                    LastName        = "Djetlic",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = false,
                    IsEmailVerified = false
                },
                    new User
                {
                    FirstName       = "Tartar",
                    LastName        = "Majonezic",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = false,
                    IsEmailVerified = false
                }
                );
            }

            if (!context.Products.Any())
            {
                context.AddRange
                (
                    new Product
                {
                    Name          = "Paulaner",
                    Price         = 18,
                    Description   = "German beer, top kvaliteta",
                    ProductSorter = ProductSorters["Piva"],
                    ImageURL      = "https://www.wishbeer.com/1023-large_default/paulaner-hefe-weissbier-naturtrub-500-ml-55.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Karlovacko",
                    Price         = 12,
                    Description   = "Hrvatsko pivo iz Karlovca",
                    ProductSorter = ProductSorters["Piva"],
                    ImageURL      = "https://www.totalwine.com/media/sys_master/twmmedia/h6f/h7f/10675623002142.png",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Ozujsko",
                    Price         = 11,
                    Description   = "Hrvatsko pivo",
                    ProductSorter = ProductSorters["Piva"],
                    ImageURL      = "http://res.cloudinary.com/ratebeer/image/upload/w_200,h_200,c_pad,d_beer_img_default.png,f_auto/beer_9374",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Vodka",
                    Price         = 15,
                    Description   = "Mother russia!",
                    ProductSorter = ProductSorters["Zestica"],
                    ImageURL      = "https://img.thewhiskyexchange.com/540/vodka_bel12.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Rakija",
                    Price         = 15,
                    Description   = "Dobra rakija prolaza vrjedi!",
                    ProductSorter = ProductSorters["Zestica"],
                    ImageURL      = "http://bulgarianfoodforyou.com/wp-content/uploads/2015/03/Rakia-Rubaiyat.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "Whiskey",
                    Price         = 9,
                    Description   = "Dobar viski protiv losih misli!",
                    ProductSorter = ProductSorters["Zestica"],
                    ImageURL      = "https://prods3.imgix.net/images/articles/2016_11/Non-Feature-Difference-Between-Whiskey-Whisky.jpg?auto=format%2Ccompress&ixjsv=2.2.3&w=670",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "Coca-Cola",
                    Price         = 10,
                    Description   = "Svi znamo za coca-colu!",
                    ProductSorter = ProductSorters["Sok"],
                    ImageURL      = "https://target.scene7.com/is/image/Target/12953529?wid=488&hei=488&fmt=pjpeg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Fanta",
                    Price         = 8,
                    Description   = "Svi znamo za fantu",
                    ProductSorter = ProductSorters["Sok"],
                    ImageURL      = "https://www.britishcornershop.co.uk/img/large/SGN0316.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Juice",
                    Price         = 6,
                    Description   = "Vocni sokovi s velikim udjelom voca",
                    ProductSorter = ProductSorters["Sok"],
                    ImageURL      = "http://cdn3.foodviva.com/static-content/food-images/juice-recipes/orange-pineapple-juice-recipe/orange-pineapple-juice-recipe.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                }
                );
            }

            context.SaveChanges();
        }
        public static void Seed(IApplicationBuilder applicationBuilder)
        {
            AppDbContext context =
                applicationBuilder.ApplicationServices.GetRequiredService <AppDbContext>();

            if (!context.ProductSorters.Any())
            {
                context.ProductSorters.AddRange(ProductSorters.Select(c => c.Value));
            }
            if (!context.UsersData.Any())
            {
                context.AddRange
                (
                    new User
                {
                    FirstName       = "Bozo",
                    LastName        = "Admin",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = true,
                    IsEmailVerified = true
                }
                );
            }

            if (!context.Products.Any())
            {
                context.AddRange
                (
                    new Product
                {
                    Name          = "Super Mario Bros.",
                    Price         = 50,
                    Description   = "Stara igrica i dalje vrlo popularna",
                    ProductSorter = ProductSorters["Platform"],
                    ImageURL      = "/Images/supermario.png",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Fortnite",
                    Price         = 0,
                    Description   = "Najstreamnija igra trenutno!",
                    ProductSorter = ProductSorters["Shooting"],
                    ImageURL      = "/Images/fortnite.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Call Of Duty",
                    Price         = 400,
                    Description   = "Igra s puno nastavaka te pricom koja prati svaki dio",
                    ProductSorter = ProductSorters["Shooting"],
                    ImageURL      = "/Images/cod.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Donkey Kong",
                    Price         = 50,
                    Description   = "Old school. Say no more.",
                    ProductSorter = ProductSorters["Platform"],
                    ImageURL      = "/Images/donkey.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Tekken",
                    Price         = 200,
                    Description   = "Fighting igrica, jos jedan klasik prvo izasao za PS",
                    ProductSorter = ProductSorters["Fighting"],
                    ImageURL      = "/Images/tekken.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "Mortal Kombat",
                    Price         = 250,
                    Description   = "Stari ili novi? Pitanje je sad",
                    ProductSorter = ProductSorters["Fighting"],
                    ImageURL      = "/Images/mortal.jpeg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "World Of Warcraft",
                    Price         = 15,
                    Description   = "Igra koja dominira zadnje desetljece",
                    ProductSorter = ProductSorters["Strategic"],
                    ImageURL      = "/Images/wow.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Stronghold",
                    Price         = 0,
                    Description   = "Cisti primjer strateske igre",
                    ProductSorter = ProductSorters["Strategic"],
                    ImageURL      = "/Images/stronghold.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Age Of Empires",
                    Price         = 0,
                    Description   = "Tko je krenuo sa strategijama, krenuo je s ovom igricom!",
                    ProductSorter = ProductSorters["Strategic"],
                    ImageURL      = "/Images/ageofempires.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                }
                );
            }

            context.SaveChanges();
        }
示例#3
0
        public static void Seed(IApplicationBuilder applicationBuilder)
        {
            AppDbContext context =
                applicationBuilder.ApplicationServices.GetRequiredService <AppDbContext>();

            if (!context.ProductSorters.Any())
            {
                context.ProductSorters.AddRange(ProductSorters.Select(c => c.Value));
            }
            if (!context.UsersData.Any())
            {
                context.AddRange
                (
                    new User
                {
                    FirstName       = "David",
                    LastName        = "Curkovic",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = true,
                    IsEmailVerified = true
                },
                    new User
                {
                    FirstName       = "Dominik",
                    LastName        = "Matic",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = false,
                    IsEmailVerified = false
                },
                    new User
                {
                    FirstName       = "Roko",
                    LastName        = "Mitrovic",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = false,
                    IsEmailVerified = false
                }
                );
            }

            if (!context.Products.Any())
            {
                context.AddRange
                (
                    new Product
                {
                    Name          = "Volkswagen",
                    Price         = 50000,
                    Description   = "Obiteljski auto",
                    ProductSorter = ProductSorters["Limuzina"],
                    ImageURL      = "https://www.cicis.com/media/1138/pizza_trad_pepperoni.png",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Mercedes",
                    Price         = 45000,
                    Description   = "Uvijek pali!",
                    ProductSorter = ProductSorters["Limuzina"],
                    ImageURL      = "http://finedininglovers.cdn.crosscast-system.com/ImageAlbum/15522/original_burek-finedininglovers-greek.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "BMW",
                    Price         = 70000,
                    Description   = "Puno trosi!",
                    ProductSorter = ProductSorters["Limuzina"],
                    ImageURL      = "https://fthmb.tqn.com/SKjfxljgeY0nBIglJsTCKXd-akk=/5120x3413/filters:fill(auto,1)/white-bread-467775351-58a6ffd23df78c345b657e2f.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "MAN",
                    Price         = 100000,
                    Description   = "Stvoren za velike udaljenosti!",
                    ProductSorter = ProductSorters["Kamion"],
                    ImageURL      = "https://www.nautilusplus.com/content/uploads/2013/04/Bread.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Suzuki",
                    Price         = 40000,
                    Description   = "Brzina i stabilnost!",
                    ProductSorter = ProductSorters["Motor"],
                    ImageURL      = "http://www.jennycraig.com/statics/img/catalog/products/PI0202-048_fullwidth.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Kawasaki",
                    Price         = 45000,
                    Description   = "Sigurnost na prvom mjestu!",
                    ProductSorter = ProductSorters["Motor"],
                    ImageURL      = "http://www.creationfood.ca/wp-content/uploads/2015/02/croissants-korea-AFPrelax-151113.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                }
                );
            }

            context.SaveChanges();
        }
        public static void Seed(IApplicationBuilder applicationBuilder)
        {
            AppDbContext context =
                applicationBuilder.ApplicationServices.GetRequiredService <AppDbContext>();

            if (!context.ProductSorters.Any())
            {
                context.ProductSorters.AddRange(ProductSorters.Select(c => c.Value));
            }
            if (!context.UsersData.Any())
            {
                context.AddRange
                (
                    new User
                {
                    FirstName       = "Endy",
                    LastName        = "Prekpalaj",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = true,
                    IsEmailVerified = true
                },
                    new User
                {
                    FirstName       = "Josip",
                    LastName        = "Rukavina",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = false,
                    IsEmailVerified = false
                },
                    new User
                {
                    FirstName       = "Samuel",
                    LastName        = "Kolgjeraj",
                    Email           = "*****@*****.**",
                    Password        = "******",
                    IsAdmin         = false,
                    IsEmailVerified = false
                }
                );
            }

            if (!context.Products.Any())
            {
                context.AddRange
                (
                    new Product
                {
                    Name          = "Pizza",
                    Price         = 12,
                    Description   = "Always freshly baked",
                    ProductSorter = ProductSorters["Bagels"],
                    ImageURL      = "https://www.cicis.com/media/1138/pizza_trad_pepperoni.png",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Burek",
                    Price         = 15,
                    Description   = "Full of meat... or cheese. Your choice.",
                    ProductSorter = ProductSorters["Bagels"],
                    ImageURL      = "http://finedininglovers.cdn.crosscast-system.com/ImageAlbum/15522/original_burek-finedininglovers-greek.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "White bread",
                    Price         = 9,
                    Description   = "Freshly baked",
                    ProductSorter = ProductSorters["Breads"],
                    ImageURL      = "https://fthmb.tqn.com/SKjfxljgeY0nBIglJsTCKXd-akk=/5120x3413/filters:fill(auto,1)/white-bread-467775351-58a6ffd23df78c345b657e2f.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                },
                    new Product
                {
                    Name          = "Integral bread",
                    Price         = 10,
                    Description   = "You love healthy? We are all for it.",
                    ProductSorter = ProductSorters["Breads"],
                    ImageURL      = "https://www.nautilusplus.com/content/uploads/2013/04/Bread.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Muffin",
                    Price         = 8,
                    Description   = "Sweeter than your next.",
                    ProductSorter = ProductSorters["Sweets"],
                    ImageURL      = "http://www.jennycraig.com/statics/img/catalog/products/PI0202-048_fullwidth.jpg",
                    InStock       = true,
                    IsMostLiked   = false
                },
                    new Product
                {
                    Name          = "Croissant",
                    Price         = 6,
                    Description   = "Classic shit!",
                    ProductSorter = ProductSorters["Sweets"],
                    ImageURL      = "http://www.creationfood.ca/wp-content/uploads/2015/02/croissants-korea-AFPrelax-151113.jpg",
                    InStock       = true,
                    IsMostLiked   = true
                }
                );
            }

            context.SaveChanges();
        }