Ejemplo n.º 1
0
        private static void AddMusics(MusicalContext context)
        {
            if (context.Musics.Any())
            {
                return;
            }

            var musics = new Music[]
            {
                new Music {
                    Name = "Echoes", ArtistID = 1, GenreID = 1
                },
                new Music {
                    Name = "Time", ArtistID = 1, GenreID = 1
                },
                new Music {
                    Name = "Astronomy Domine", ArtistID = 1, GenreID = 6
                },
                new Music {
                    Name = "Everything She Wants", ArtistID = 2, GenreID = 2
                },
                new Music {
                    Name = "I'm Your Man", ArtistID = 2, GenreID = 2
                },
                new Music {
                    Name = "Back In Black", ArtistID = 3, GenreID = 4
                },
                new Music {
                    Name = "Master Of Puppets", ArtistID = 4, GenreID = 3
                },
                new Music {
                    Name = "Call Of Ktulu", ArtistID = 4, GenreID = 3
                },
                new Music {
                    Name = "Enter Sandman", ArtistID = 4, GenreID = 4
                },
                new Music {
                    Name = "Love Me Do", ArtistID = 5, GenreID = 5
                },
                new Music {
                    Name = "Strawberry Fields Forever", ArtistID = 5, GenreID = 5
                },
                new Music {
                    Name = "A Day In Life", ArtistID = 5, GenreID = 5
                },
                new Music {
                    Name = "Good Vibrations", ArtistID = 6, GenreID = 5
                },
                new Music {
                    Name = "Sloop John B", ArtistID = 6, GenreID = 5
                }
            };

            foreach (Music m in musics)
            {
                context.Musics.Add(m);
            }

            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            db         = new MusicalContext();
            filterList = new List <string>();
            InitializeComponent();

            LoadDisks();
            LoadComboBoxes();
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            DbContextOptions <MusicalContext> options = new DbContextOptionsBuilder <MusicalContext>().UseSqlServer("Server=LPT-FA3420\\SQLEXPRESS;Database=WebPollTest;Trusted_Connection=True;MultipleActiveResultSets=true").Options;

            _context = new MusicalContext(options);

            DbInitializer.Initialize(_context);

            _mapper = new Mapper(new MapperConfiguration(cfg => cfg.AddProfile <MappingProfile>()));
        }
Ejemplo n.º 4
0
        public static void Initialize(MusicalContext context)
        {
            //Cria a DB caso esta nao exista
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            AddGenre(context);
            AddArtists(context);
            AddMusics(context);
        }
Ejemplo n.º 5
0
        private static void AddGenre(MusicalContext context)
        {
            if (context.Genres.Any())
            {
                return;
            }

            var genres = new Genre[]
            {
                new Genre {
                    Name = "Prog Rock"
                },
                new Genre {
                    Name = "Pop"
                },
                new Genre {
                    Name = "Metal"
                },
                new Genre {
                    Name = "Hard Rock"
                },
                new Genre {
                    Name = "Pop Rock"
                },
                new Genre {
                    Name = "Acid Rock"
                },
                new Genre {
                    Name = "KPop"
                }
            };

            foreach (Genre g in genres)
            {
                context.Genres.Add(g);
            }

            context.SaveChanges();
        }
Ejemplo n.º 6
0
        private static void AddArtists(MusicalContext context)
        {
            if (context.Artists.Any())
            {
                return;
            }

            var artists = new Artist[]
            {
                new Artist {
                    Name = "Pink Floyd"
                },
                new Artist {
                    Name = "Wham!"
                },
                new Artist {
                    Name = "AC/DC"
                },
                new Artist {
                    Name = "Metallica"
                },
                new Artist {
                    Name = "The Beatles"
                },
                new Artist {
                    Name = "The Beach Boys"
                },
                new Artist {
                    Name = "Oasis"
                }
            };

            foreach (Artist a in artists)
            {
                context.Artists.Add(a);
            }

            context.SaveChanges();
        }
Ejemplo n.º 7
0
 public Repository(MusicalContext db)
 {
     this._db = db;
 }
Ejemplo n.º 8
0
 public ReviewRepository(MusicalContext db) : base(db)
 {
 }
Ejemplo n.º 9
0
 public LoginWindow()
 {
     db = new MusicalContext();
     InitializeComponent();
 }
Ejemplo n.º 10
0
 public MusicalRepository(MusicalContext db) : base(db)
 {
 }