protected override void Seed(MusicShopDbContext context) { base.Seed(context); Account admin = new Account() { Login = "******", Password = "******", IsClient = false }; Account ac1 = new Account() { Login = "******", Password = "******", IsClient = true }; Account ac2 = new Account() { Login = "******", Password = "******", IsClient = true }; context.Accounts.Add(admin); context.Accounts.Add(ac1); context.Accounts.Add(ac2); context.SaveChanges(); Client dr4m4client = new Client() { Name = "Roman", Surname = "Smirnov", Email = "*****@*****.**", AccountId = ac1.Id, Phone = "+38030303003" }; Client petroclient = new Client() { Name = "Petro", Surname = "Ivanov", Email = "*****@*****.**", AccountId = ac2.Id, Phone = "+3808383833" }; context.Clients.Add(dr4m4client); context.Clients.Add(petroclient); context.SaveChanges(); Genre pop = new Genre() { Name = "Pop" }; Genre poppunk = new Genre() { Name = "Pop punk" }; Genre alrock = new Genre() { Name = "Alternative rock" }; Genre hipHop = new Genre() { Name = "Hip-Hop" }; Genre emorap = new Genre() { Name = "Emo rap" }; Genre emotrap = new Genre() { Name = "Emo trap" }; Genre lofi = new Genre() { Name = "Lo-fi" }; Genre rB = new Genre() { Name = "R&B" }; Genre tripHop = new Genre() { Name = "Trip hop" }; context.Genres.Add(pop); context.Genres.Add(poppunk); context.Genres.Add(alrock); context.Genres.Add(hipHop); context.Genres.Add(emorap); context.Genres.Add(emotrap); context.Genres.Add(lofi); context.Genres.Add(rB); context.Genres.Add(tripHop); context.SaveChanges(); Artist yungBlud = new Artist() { Name = "YUNGBLUD" }; Artist lilpeep = new Artist() { Name = "Lil Peep" }; Artist oliverTree = new Artist() { Name = "Oliver Tree" }; Artist joji = new Artist() { Name = "Joji" }; Artist girlInRed = new Artist() { Name = "Girl in Red" }; Artist juiceWRLD = new Artist() { Name = "Juice WRLD" }; Artist xXXTentacion = new Artist() { Name = "XXXTentacion" }; Artist billieEilish = new Artist() { Name = "Billie Eilish" }; context.Artists.Add(yungBlud); context.Artists.Add(lilpeep); context.Artists.Add(oliverTree); context.Artists.Add(joji); context.Artists.Add(girlInRed); context.Artists.Add(juiceWRLD); context.Artists.Add(xXXTentacion); context.Artists.Add(billieEilish); context.SaveChanges(); Publisher p1 = new Publisher() { Name = "Universal Music Group" }; Publisher p2 = new Publisher() { Name = "Locomotion Recordings" }; Publisher p3 = new Publisher() { Name = "AWAL" }; Publisher p4 = new Publisher() { Name = "Columbia Records" }; Publisher p5 = new Publisher() { Name = "Atlantic Records" }; Publisher p6 = new Publisher() { Name = "88rising Music" }; context.Publishers.Add(p1); context.Publishers.Add(p2); context.Publishers.Add(p3); context.Publishers.Add(p4); context.Publishers.Add(p5); context.Publishers.Add(p6); context.SaveChanges(); Deal dealHipHop = new Deal() { Name = "Hip-Hop", StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(7), Discount = 10 }; context.Deals.Add(dealHipHop); Record weird = new Record() { ArtistId = yungBlud.Id, PublisherId = p1.Id, Name = "a weird! af halloween", SellingPrice = 220, CountSongs = 6, CostPrice = 180, DateOfPublishing = new System.DateTime(2020, 10, 30), GenreId = alrock.Id }; Record underrated = new Record() { ArtistId = yungBlud.Id, PublisherId = p2.Id, Name = "the underrated youth", SellingPrice = 250, CountSongs = 6, CostPrice = 220, DateOfPublishing = new System.DateTime(2019, 10, 18), GenreId = alrock.Id }; Record century = new Record() { ArtistId = yungBlud.Id, PublisherId = p2.Id, Name = "21st Century Liability", CostPrice = 420, SellingPrice = 500, CountSongs = 12, DateOfPublishing = new System.DateTime(2018, 7, 6), GenreId = alrock.Id }; //----------------------------------------------- Record pt1 = new Record() { ArtistId = lilpeep.Id, PublisherId = p3.Id, Name = "Come Over When You're Sober, Pt. 1", SellingPrice = 100, CountSongs = 2, CostPrice = 80, DateOfPublishing = new System.DateTime(2017, 9, 15), GenreId = emorap.Id }; Record pt2 = new Record() { ArtistId = lilpeep.Id, PublisherId = p4.Id, Name = "Come Over When You're Sober, Pt. 2", SellingPrice = 550, CountSongs = 11, CostPrice = 450, Deal = dealHipHop, DateOfPublishing = new System.DateTime(2018, 11, 9), GenreId = hipHop.Id }; Record crybaby = new Record() { ArtistId = lilpeep.Id, PublisherId = p1.Id, Name = "Crybaby", SellingPrice = 550, CountSongs = 11, CostPrice = 480, Deal = dealHipHop, DateOfPublishing = new System.DateTime(2016, 6, 10), GenreId = hipHop.Id }; Record ee = new Record() { ArtistId = lilpeep.Id, PublisherId = p4.Id, Name = "Everybody’s everything", SellingPrice = 670, CountSongs = 19, CostPrice = 600, DateOfPublishing = new System.DateTime(2018, 7, 6), GenreId = emorap.Id }; Record gas = new Record() { ArtistId = lilpeep.Id, PublisherId = p2.Id, Name = "Goth Angel Sinner", SellingPrice = 100, CountSongs = 3, CostPrice = 90, DateOfPublishing = new System.DateTime(2019, 10, 31), GenreId = emorap.Id }; Record hellboy = new Record() { ArtistId = lilpeep.Id, PublisherId = p2.Id, Name = "Hellboy", SellingPrice = 650, CountSongs = 16, CostPrice = 600, Deal = dealHipHop, DateOfPublishing = new System.DateTime(2015, 9, 25), GenreId = hipHop.Id }; //------------------------------------- Record doyoufeelme = new Record() { ArtistId = oliverTree.Id, PublisherId = p5.Id, Name = "do you feel me?", SellingPrice = 270, CountSongs = 6, CostPrice = 220, DateOfPublishing = new System.DateTime(2019, 8, 6), GenreId = alrock.Id }; Record alienboy = new Record() { ArtistId = oliverTree.Id, PublisherId = p5.Id, Name = "alien boy ep", SellingPrice = 210, CountSongs = 6, CostPrice = 180, DateOfPublishing = new System.DateTime(2019, 5, 17), GenreId = alrock.Id }; Record ugly = new Record() { ArtistId = oliverTree.Id, PublisherId = p5.Id, Name = "Ugly Is Beautiful", SellingPrice = 620, CountSongs = 14, CostPrice = 580, DateOfPublishing = new System.DateTime(2020, 7, 17), GenreId = alrock.Id }; //----------------------------------------- Record nectar = new Record() { ArtistId = joji.Id, PublisherId = p6.Id, Name = "Nectar", SellingPrice = 850, CountSongs = 18, CostPrice = 800, DateOfPublishing = new System.DateTime(2020, 9, 25), GenreId = lofi.Id }; Record ballads = new Record() { ArtistId = joji.Id, PublisherId = p6.Id, Name = "Ballads 1", SellingPrice = 650, CountSongs = 12, CostPrice = 600, DateOfPublishing = new System.DateTime(2018, 10, 26), GenreId = lofi.Id }; Record inTongues = new Record() { ArtistId = joji.Id, PublisherId = p6.Id, Name = "In Tongues", SellingPrice = 250, CountSongs = 6, CostPrice = 220, DateOfPublishing = new System.DateTime(2017, 11, 3), GenreId = rB.Id }; Record pinkSeason = new Record() { ArtistId = joji.Id, PublisherId = p6.Id, Name = "Pink Season", SellingPrice = 900, CountSongs = 35, CostPrice = 780, DateOfPublishing = new System.DateTime(2017, 1, 4), GenreId = rB.Id }; Record pinkSeasonTheProphecy = new Record() { ArtistId = joji.Id, PublisherId = p6.Id, Name = "Pink Season: The Prophecy", SellingPrice = 200, CountSongs = 5, CostPrice = 180, DateOfPublishing = new System.DateTime(2017, 5, 24), GenreId = rB.Id }; //------------------------------------------------ context.Records.Add(weird); context.Records.Add(underrated); context.Records.Add(century); context.Records.Add(pt1); context.Records.Add(pt2); context.Records.Add(crybaby); context.Records.Add(ee); context.Records.Add(gas); context.Records.Add(hellboy); context.Records.Add(doyoufeelme); context.Records.Add(alienboy); context.Records.Add(ugly); context.Records.Add(nectar); context.Records.Add(ballads); context.Records.Add(inTongues); context.Records.Add(pinkSeason); context.Records.Add(pinkSeasonTheProphecy); context.SaveChanges(); //-------------------------------------- }
protected override void Seed(MusicLibraryDbContext context) { var metal = new Genre { Id = Guid.NewGuid(), Name = "Metal" }; var pop = new Genre { Id = Guid.NewGuid(), Name = "Pop" }; var electronic = new Genre { Id = Guid.NewGuid(), Name = "Electronic" }; context.Genres.AddOrUpdate(genre => genre.Id, metal, pop, electronic); var taylor = new Artist { Id = Guid.NewGuid(), Name = "Taylor Swift" }; var crown = new Artist { Id = Guid.NewGuid(), Name = "Aversions Crown" }; var infant = new Artist { Id = Guid.NewGuid(), Name = "Infant Annihilator" }; context.Artists.AddOrUpdate(artist => artist.Id, taylor, crown, infant); var admin = new User { Id = Guid.NewGuid(), Address = "None 1", Admin = true, Email = "*****@*****.**", FirstName = "Real", LastName = "Administrator", MobilePhoneNumber = "+456" }; var pleb = new User { Id = Guid.NewGuid(), Address = "Everywhere 6", Admin = false, Email = "*****@*****.**", FirstName = "Random", LastName = "Pleb", MobilePhoneNumber = "221306" }; context.Users.AddOrUpdate(user => user.Id, admin, pleb); var red = new Album { Id = Guid.NewGuid(), Artist = taylor, ArtistId = taylor.Id, Cover = "fill_path", Genre = pop, GenreId = pop.Id, Name = "Red", ReleaseDate = new DateTime(2013, 12, 1) }; var xenocide = new Album { Id = Guid.NewGuid(), ReleaseDate = new DateTime(2016, 3, 6), Name = "Xenocide", Artist = crown, ArtistId = crown.Id, Cover = "fill_in", Genre = metal, GenreId = metal.Id }; var palp = new Album { Id = Guid.NewGuid(), GenreId = metal.Id, Genre = metal, Cover = "not_in_here", Artist = infant, ArtistId = infant.Id, Name = "The Palpable Leprosy of Polution", ReleaseDate = new DateTime(2010, 8, 12) }; var tyrant = new Album { Id = Guid.NewGuid(), ReleaseDate = new DateTime(2010, 1, 1), Name = "Tyrant", Artist = crown, ArtistId = crown.Id, Cover = "fill_in", Genre = metal, GenreId = metal.Id }; context.Albums.AddOrUpdate(album => album.Id, red, xenocide, palp, tyrant); var adminsTaylor = new UsersArtist { Id = Guid.NewGuid(), Artist = taylor, ArtistId = taylor.Id, User = admin, UserId = admin.Id }; var plebsInfant = new UsersArtist { Id = Guid.NewGuid(), UserId = pleb.Id, User = pleb, Artist = infant, ArtistId = infant.Id }; var plebsCrown = new UsersArtist { Id = Guid.NewGuid(), User = pleb, ArtistId = crown.Id, Artist = crown, UserId = pleb.Id }; context.UsersArtists.AddOrUpdate(usal => usal.Id, adminsTaylor, plebsCrown, plebsInfant); var twenty = new Song { Id = Guid.NewGuid(), Album = red, AlbumId = red.Id, Name = "22" }; var trouble = new Song { Id = Guid.NewGuid(), Album = red, AlbumId = red.Id, Name = "I knew You were Trouble" }; var abyss = new Song { Id = Guid.NewGuid(), Name = "Prismatic Abyss", AlbumId = xenocide.Id, Album = xenocide }; var ccrusher = new Song { Id = Guid.NewGuid(), Album = palp, Name = "CtCrusher", AlbumId = palp.Id }; context.Songs.AddOrUpdate(song => song.Id, twenty, trouble, ccrusher, abyss); var adminnsXeno = new UsersAlbum { Id = Guid.NewGuid(), Album = xenocide, AlbumId = xenocide.Id, User = admin, UserId = admin.Id }; var plebsRed = new UsersAlbum { Id = Guid.NewGuid(), User = pleb, UserId = pleb.Id, Album = red, AlbumId = red.Id }; context.UsersAlbums.AddOrUpdate(userAlbum => userAlbum.Id, adminnsXeno, plebsRed); var adminsCrusher = new UsersSong { Id = Guid.NewGuid(), User = admin, UserId = admin.Id, Song = ccrusher, SongId = ccrusher.Id }; context.UsersSongs.AddOrUpdate(userSong => userSong.Id, adminsCrusher); context.SaveChanges(); base.Seed(context); }