Ejemplo n.º 1
0
        public static void AddArtist()
        {
            var artist = new Artist()
            {
                Name        = ReadInput.ReadString("Artist name: "),
                Country     = ReadInput.ReadString("Country of origin: "),
                YearStarted = ReadInput.ReadInt("Year formed: ")
            };

            Program.DataBase.Add(artist);
            Program.DataBase.SaveChanges();
        }
Ejemplo n.º 2
0
        public static void AddAlbum()
        {
            var album = new Album()
            {
                Title       = ReadInput.ReadString("Title of album: "),
                ReleaseDate = ReadInput.ReadInt("Year of release: "),
            };
            string artist = Menu.DrawMenu("Wich artist?", Program.DataBase.Artist.Select(z => z.Name).ToArray());

            album.Artists = Program.DataBase.Artist.Where(x => x.Name == artist).First();
            Program.DataBase.Add(album);
            Program.DataBase.SaveChanges();
        }
Ejemplo n.º 3
0
        public static void AddSong()
        {
            var song = new Song()
            {
                Title         = ReadInput.ReadString("Title of track: "),
                Length        = ReadInput.ReadInt("Length in seconds: "),
                TrackNumber   = ReadInput.ReadInt("Tracknumber on album: "),
                HasMusicVideo = ReadInput.ReadString("Has music video(Y/N):").ToLower() == ("y") ? true : false,
            };

            string artist = Menu.DrawMenu("Wich artist? ", Program.DataBase.Artist.Select(n => n.Name).ToArray());

            string album = Menu.DrawMenu("Wich album?", Program.DataBase.Album.Where(n => n.Artists.Name == artist).Select(y => y.Title).ToArray());

            song.Albums = Program.DataBase.Album.Where(x => x.Title == album).First();


            Program.DataBase.Add(song);
            Program.DataBase.SaveChanges();
        }
Ejemplo n.º 4
0
 internal static void ListSongsSearchName()
 {
     if (Program.DataBase.Artist.Count() == 0)
     {
         Console.WriteLine("There are no Albums in the database.");
     }
     else
     {
         Program.DataBase.Song.Include(a => a.Albums.Artists).Where(z => z.Title.ToLower().Contains(ReadInput.ReadString("Song title? ").ToLower()))
         .ToList()
         .ForEach(x => Console.WriteLine($"{x.Title}, Length: {x.Length / 60:00}:{x.Length % 60:00}," +
                                         $" has music video: {(x.HasMusicVideo == true ? "Yes" : "No")}\nLyrics:\n{x.Lyrics} \nby {x.Albums.Artists.Name}\n==============================================="));
     }
 }