Esempio n. 1
0
        private void SeedArtists(IMusicArtistsDbContext context)
        {
            if (context.Artists.Any())
            {
                return;
            }
            var christina = new Artist()
            {
                Name    = "Christina Aguilera",
                Country = "USA",
            };

            christina.Albums = new List <Album>()
            {
                new Album()
                {
                    Name     = "Dirrty",
                    Genre    = "Pop",
                    Producer = "Christina Aguilera",
                    Songs    = new List <Song>()
                    {
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Dirrty"
                        }
                    }
                },
                new Album()
                {
                    Name     = "Stripped",
                    Genre    = "Pop",
                    Producer = "Christina Aguilera",
                    Songs    = new List <Song>()
                    {
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Stripped"
                        },
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Fighter"
                        },
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Beautyfull"
                        }
                    }
                },
                new Album()
                {
                    Name     = "BackToBasics",
                    Genre    = "Pop",
                    Producer = "Christina Aguilera",
                    Songs    = new List <Song>()
                    {
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Back"
                        },
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Basics"
                        },
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "Stronger"
                        },
                        new Song()
                        {
                            Genre = "Pop",
                            Name  = "AddOrUpdateTest"
                        }
                    }
                }
            };


            // TODO add singers INNA


            context.Artists.Add(christina);
            //context.Artists.Add(adam);
            context.SaveChanges();
        }
Esempio n. 2
0
 public MusicArtistsData(IMusicArtistsDbContext context)
 {
     this.context      = context;
     this.repositories = new Dictionary <Type, object>();
 }
Esempio n. 3
0
 public Repository(IMusicArtistsDbContext context)
 {
     this.context = context;
     this.set     = context.Set <T>();
 }