private static void AddOperatingSystemsAndBrands(FirstProjectContext context) { if (context.OS.Any() == false) { var os = new List <string>() { "Android", "iOS", "Windows" }; os.ForEach(o => context.OS.Add(new OS { Name = o })); context.SaveChanges(); } if (context.Brands.Any() == false) { var brands = new List <string>() { "Acme", "Globex", "Soylent", "Initech", "Umbrella" }; brands.ForEach(b => context.Brands.Add(new Brand { Name = b })); context.SaveChanges(); } }
private static void AddColoursFeaturesAndStorage(FirstProjectContext context) { if (!context.Colours.Any()) { var colours = new List <string>() { "Black", "White", "Gold", "Silver", "Grey", "Spacegrey", "Red", "Pink" }; colours.ForEach(c => context.Add(new Colour { Name = c })); context.SaveChanges(); } if (context.Features.Any() == false) { var features = new List <string>() { "3G", "4G", "Bluetooth", "WiFi", "Fast charge", "GPS", "NFC" }; features.ForEach(f => context.Add(new Feature { Name = f })); context.SaveChanges(); } if (context.Storage.Any() == false) { var storage = new List <int>() { 4, 8, 16, 32, 64, 128, 256 }; storage.ForEach(s => context.Storage.Add(new Storage { Capacity = s })); context.SaveChanges(); } }
private static void AddProducts(FirstProjectContext context) { if (context.Products.Any() == false) { var products = new List <Product> { new Product { Name = "Samsung Galaxy S8", Slug = "samsung-galaxy-s8", Thumbnail = "http://placehold.it/200x300", ShortDescription = "Samsung Galaxy S8 Android smartphone with true edge to edge display", Price = 499.99M, Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est." }, new Product { Name = "Samsung Galaxy S7", Slug = "samsung-galaxy-s7", Thumbnail = "http://placehold.it/200x300", ShortDescription = "Samsung Galaxy S8 Android smartphone with true edge to edge display", Price = 499.99M, Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est." }, new Product { Name = "Samsung Galaxy S6", Slug = "samsung-galaxy-s6", Thumbnail = "http://placehold.it/200x300", ShortDescription = "Samsung Galaxy S8 Android smartphone with true edge to edge display", Price = 499.99M, Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est." }, new Product { Name = "Samsung Galaxy S5", Slug = "samsung-galaxy-s5", Thumbnail = "http://placehold.it/200x300", ShortDescription = "Samsung Galaxy S8 Android smartphone with true edge to edge display", Price = 499.99M, Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est." }, new Product { Name = "Samsung Galaxy S4", Slug = "samsung-galaxy-s4", Thumbnail = "http://placehold.it/200x300", ShortDescription = "Samsung Galaxy S8 Android smartphone with true edge to edge display", Price = 499.99M, Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est." } }; // Add them in context.Products.AddRange(products); context.SaveChanges(); } }
private static void AddProducts(FirstProjectContext context) { if (context.Products.Any() == false) { var products = new List <Product>(); products.Add(new Product { Name = "Acme TNT 4", Slug = "acme-tnt-4", Thumbnail = "/assets/images/thumbnail.jpeg", ShortDescription = "Acme TNT 4 Android smartphone with true edge to edge display", Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est.", ScreenSize = 5M, TalkTime = 8M, StandbyTime = 36M, Brand = context.Brands.Single(b => b.Name == "Acme"), OS = context.OS.Single(os => os.Name == "Android"), Images = new List <Image> { new Image { Url = "/assets/images/gallery1.jpeg" }, new Image { Url = "/assets/images/gallery2.jpeg" }, new Image { Url = "/assets/images/gallery3.jpeg" }, new Image { Url = "/assets/images/gallery4.jpeg" }, new Image { Url = "/assets/images/gallery5.jpeg" }, new Image { Url = "/assets/images/gallery6.jpeg" } }, ProductFeatures = new List <ProductFeature> { new ProductFeature { Feature = context.Features.Single(f => f.Name == "3G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Bluetooth") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "WiFi") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "GPS") } }, ProductVariants = new List <ProductVariant> { new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 299M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 349M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Gold"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 319M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Gold"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 369M } } }); products.Add(new Product { Name = "Globex Scorpio", Slug = "globex-scorpio", Thumbnail = "/assets/images/thumbnail.jpeg", ShortDescription = "Globex Scorpio Windows smartphone with true edge to edge display", Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est.", ScreenSize = 7M, TalkTime = 6M, StandbyTime = 30M, Brand = context.Brands.Single(b => b.Name == "Globex"), OS = context.OS.Single(os => os.Name == "Windows"), Images = new List <Image> { new Image { Url = "/assets/images/gallery1.jpeg" }, new Image { Url = "/assets/images/gallery2.jpeg" }, new Image { Url = "/assets/images/gallery3.jpeg" }, new Image { Url = "/assets/images/gallery4.jpeg" }, new Image { Url = "/assets/images/gallery5.jpeg" }, new Image { Url = "/assets/images/gallery6.jpeg" } }, ProductFeatures = new List <ProductFeature> { new ProductFeature { Feature = context.Features.Single(f => f.Name == "3G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Bluetooth") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "WiFi") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "GPS") } }, ProductVariants = new List <ProductVariant> { new ProductVariant { Colour = context.Colours.Single(c => c.Name == "White"), Storage = context.Storage.Single(s => s.Capacity == 8), Price = 149M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "White"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 169M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 8), Price = 159M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 179M } } }); products.Add(new Product { Name = "Soylent MegaFone", Slug = "soylent-megafone", Thumbnail = "/assets/images/thumbnail.jpeg", ShortDescription = "Soylent MegaFone budget Android smartphone with true edge to edge display", Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est.", ScreenSize = 5M, TalkTime = 10M, StandbyTime = 48M, Brand = context.Brands.Single(b => b.Name == "Soylent"), OS = context.OS.Single(os => os.Name == "Android"), Images = new List <Image> { new Image { Url = "/assets/images/gallery1.jpeg" }, new Image { Url = "/assets/images/gallery2.jpeg" }, new Image { Url = "/assets/images/gallery3.jpeg" }, new Image { Url = "/assets/images/gallery4.jpeg" }, new Image { Url = "/assets/images/gallery5.jpeg" }, new Image { Url = "/assets/images/gallery6.jpeg" } }, ProductFeatures = new List <ProductFeature> { new ProductFeature { Feature = context.Features.Single(f => f.Name == "3G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Bluetooth") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "WiFi") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "GPS") } }, ProductVariants = new List <ProductVariant> { new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 4), Price = 99M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 8), Price = 119M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 139M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 4), Price = 99M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 8), Price = 119M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 139M } } }); products.Add(new Product { Name = "Initech Silicon 5", Slug = "initech-silicon-5", Thumbnail = "/assets/images/thumbnail.jpeg", ShortDescription = "Initech Silicon 5 premium iOS smartphone with true edge to edge display", Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est.", ScreenSize = 4.7M, TalkTime = 8M, StandbyTime = 36M, Brand = context.Brands.Single(b => b.Name == "Initech"), OS = context.OS.Single(os => os.Name == "iOS"), Images = new List <Image> { new Image { Url = "/assets/images/gallery1.jpeg" }, new Image { Url = "/assets/images/gallery2.jpeg" }, new Image { Url = "/assets/images/gallery3.jpeg" }, new Image { Url = "/assets/images/gallery4.jpeg" }, new Image { Url = "/assets/images/gallery5.jpeg" }, new Image { Url = "/assets/images/gallery6.jpeg" } }, ProductFeatures = new List <ProductFeature> { new ProductFeature { Feature = context.Features.Single(f => f.Name == "3G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "4G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Bluetooth") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "WiFi") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "GPS") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Fast charge") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "NFC") } }, ProductVariants = new List <ProductVariant> { new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 128), Price = 799M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 256), Price = 899M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 128), Price = 799M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 256), Price = 899M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 128), Price = 799M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 256), Price = 899M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 799M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 128), Price = 899M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 256), Price = 999M } } }); products.Add(new Product { Name = "Umbrella T3", Slug = "umbrella-t3", Thumbnail = "/assets/images/thumbnail.jpeg", ShortDescription = "Umbrella T3 premium Android smartphone with true edge to edge display", Description = "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis tempora ad cum laudantium, omnis fugit amet iure animi corporis labore repellat magnam perspiciatis explicabo maiores fuga provident a obcaecati tenetur nostrum, quidem quod dignissimos, voluptatem quasi? Nisi quaerat, fugit voluptas ducimus facilis impedit quod dicta, laborum sint iure nihil veniam aspernatur delectus officia culpa, at cupiditate? Totam minima ut deleniti laboriosam dolores cumque in, nesciunt optio! Quod recusandae voluptate facere pariatur soluta vel corrupti tenetur aut maiores, cumque mollitia fugiat laudantium error odit voluptas nobis laboriosam quo, rem deleniti? Iste quidem amet perferendis sed iusto tempora modi illo tempore quibusdam laborum? Dicta aliquam libero, facere, maxime corporis qui officiis explicabo aspernatur non consequatur mollitia iure magnam odit enim. Eligendi suscipit, optio officiis repellat eos quis iure? Omnis, error aliquid quibusdam iste amet nihil nisi cumque magni sequi enim illo autem nesciunt optio accusantium animi commodi tenetur neque eum vitae est.", ScreenSize = 5.5M, TalkTime = 8M, StandbyTime = 36M, Brand = context.Brands.Single(b => b.Name == "Umbrella"), OS = context.OS.Single(os => os.Name == "Android"), Images = new List <Image> { new Image { Url = "/assets/images/gallery1.jpeg" }, new Image { Url = "/assets/images/gallery2.jpeg" }, new Image { Url = "/assets/images/gallery3.jpeg" }, new Image { Url = "/assets/images/gallery4.jpeg" }, new Image { Url = "/assets/images/gallery5.jpeg" }, new Image { Url = "/assets/images/gallery6.jpeg" } }, ProductFeatures = new List <ProductFeature> { new ProductFeature { Feature = context.Features.Single(f => f.Name == "3G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "4G") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Bluetooth") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "WiFi") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "GPS") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "Fast charge") }, new ProductFeature { Feature = context.Features.Single(f => f.Name == "NFC") } }, ProductVariants = new List <ProductVariant> { new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 499M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Black"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 499M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Silver"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 499M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Grey"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 499M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Spacegrey"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Red"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 499M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Red"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Red"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Pink"), Storage = context.Storage.Single(s => s.Capacity == 16), Price = 499M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Pink"), Storage = context.Storage.Single(s => s.Capacity == 32), Price = 599M }, new ProductVariant { Colour = context.Colours.Single(c => c.Name == "Pink"), Storage = context.Storage.Single(s => s.Capacity == 64), Price = 699M } } }); context.Products.AddRange(products); context.SaveChanges(); } }
public void Seed() { if (_context.Department.Any() || _context.Seller.Any() || _context.SalesRecord.Any()) { return; } Department d1 = new Department("Computers"); Department d2 = new Department("Eletronics"); Department d3 = new Department("Fashion"); Department d4 = new Department("Books"); Seller s1 = new Seller("Bob Brown", "*****@*****.**", new DateTime(1998, 4, 21), 1000.00, d1); Seller s2 = new Seller("Brown", "*****@*****.**", new DateTime(1995, 2, 20), 1500.00, d2); Seller s3 = new Seller("John", "*****@*****.**", new DateTime(1985, 10, 05), 2000.00, d2); Seller s4 = new Seller("Arthur", "*****@*****.**", new DateTime(1980, 5, 17), 2500.00, d3); Seller s5 = new Seller("Morgan", "*****@*****.**", new DateTime(1975, 7, 30), 3000.00, d4); Seller s6 = new Seller("Micah", "*****@*****.**", new DateTime(1990, 1, 19), 1900.00, d3); SalesRecord r1 = new SalesRecord(new DateTime(2018, 09, 25), 11000.0, SaleStatus.Billed, s1); SalesRecord r2 = new SalesRecord(new DateTime(2018, 09, 4), 7000.0, SaleStatus.Billed, s5); SalesRecord r3 = new SalesRecord(new DateTime(2018, 09, 13), 4000.0, SaleStatus.Canceled, s4); SalesRecord r4 = new SalesRecord(new DateTime(2018, 09, 1), 8000.0, SaleStatus.Billed, s1); SalesRecord r5 = new SalesRecord(new DateTime(2018, 09, 21), 3000.0, SaleStatus.Billed, s3); SalesRecord r6 = new SalesRecord(new DateTime(2018, 09, 15), 2000.0, SaleStatus.Billed, s1); SalesRecord r7 = new SalesRecord(new DateTime(2018, 09, 28), 13000.0, SaleStatus.Billed, s2); SalesRecord r8 = new SalesRecord(new DateTime(2018, 09, 11), 4000.0, SaleStatus.Billed, s4); SalesRecord r9 = new SalesRecord(new DateTime(2018, 09, 14), 11000.0, SaleStatus.Pending, s6); SalesRecord r10 = new SalesRecord(new DateTime(2018, 09, 7), 9000.0, SaleStatus.Billed, s6); SalesRecord r11 = new SalesRecord(new DateTime(2018, 09, 13), 6000.0, SaleStatus.Billed, s2); SalesRecord r12 = new SalesRecord(new DateTime(2018, 09, 25), 7000.0, SaleStatus.Pending, s3); SalesRecord r13 = new SalesRecord(new DateTime(2018, 09, 29), 10000.0, SaleStatus.Billed, s4); SalesRecord r14 = new SalesRecord(new DateTime(2018, 09, 4), 3000.0, SaleStatus.Billed, s5); SalesRecord r15 = new SalesRecord(new DateTime(2018, 09, 12), 4000.0, SaleStatus.Billed, s1); SalesRecord r16 = new SalesRecord(new DateTime(2018, 10, 5), 2000.0, SaleStatus.Billed, s4); SalesRecord r17 = new SalesRecord(new DateTime(2018, 10, 1), 12000.0, SaleStatus.Billed, s1); SalesRecord r18 = new SalesRecord(new DateTime(2018, 10, 24), 6000.0, SaleStatus.Billed, s3); SalesRecord r19 = new SalesRecord(new DateTime(2018, 10, 22), 8000.0, SaleStatus.Billed, s5); SalesRecord r20 = new SalesRecord(new DateTime(2018, 10, 15), 8000.0, SaleStatus.Billed, s6); SalesRecord r21 = new SalesRecord(new DateTime(2018, 10, 17), 9000.0, SaleStatus.Billed, s2); SalesRecord r22 = new SalesRecord(new DateTime(2018, 10, 24), 4000.0, SaleStatus.Billed, s4); SalesRecord r23 = new SalesRecord(new DateTime(2018, 10, 19), 11000.0, SaleStatus.Canceled, s2); SalesRecord r24 = new SalesRecord(new DateTime(2018, 10, 12), 8000.0, SaleStatus.Billed, s5); SalesRecord r25 = new SalesRecord(new DateTime(2018, 10, 31), 7000.0, SaleStatus.Billed, s3); SalesRecord r26 = new SalesRecord(new DateTime(2018, 10, 6), 5000.0, SaleStatus.Billed, s4); SalesRecord r27 = new SalesRecord(new DateTime(2018, 10, 13), 9000.0, SaleStatus.Pending, s1); SalesRecord r28 = new SalesRecord(new DateTime(2018, 10, 7), 4000.0, SaleStatus.Billed, s3); SalesRecord r29 = new SalesRecord(new DateTime(2018, 10, 23), 12000.0, SaleStatus.Billed, s5); SalesRecord r30 = new SalesRecord(new DateTime(2018, 10, 12), 5000.0, SaleStatus.Billed, s2); _context.Department.AddRange(d1, d2, d3, d4); _context.Seller.AddRange(s1, s2, s3, s4, s5, s6); _context.SalesRecord.AddRange( r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, r30 ); _context.SaveChanges(); }