Beispiel #1
0
        public void PrintBandSongs(DBContext context, SongEngine songEngine, BandEngine bandEngine)
        {
            Console.WriteLine("Введите название группы");
            string bandName = Console.ReadLine();
            var    band     = bandEngine.GetBandbyName(context, bandName);
            var    songs    = songEngine.GetSongsbyBand(context, band);
            int    counter  = 2;

            Console.WriteLine($"Список песен {band.Name} :");

            foreach (var song in songs)
            {
                if (counter % 2 == 0)
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    Console.WriteLine($"{song.Name} {song.Band.Name} {song.MusicAuthor} {song.TextAuthor} {song.IssueDate.ToString("yyyy/MM/dd")}");
                    Console.ResetColor();
                    Console.WriteLine();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.WriteLine($"{song.Name} {song.Band.Name} {song.MusicAuthor} {song.TextAuthor} {song.IssueDate.ToString("yyyy/MM/dd")}");
                    Console.ResetColor();
                    Console.WriteLine();
                }
                counter++;
            }
        }
Beispiel #2
0
        public void PrintBands(DBContext context, BandEngine bandEngine, Manager manager)
        {
            var bands   = bandEngine.GetBands(context, manager);
            int counter = 2;

            foreach (var band in bands)
            {
                if (counter % 2 == 0)
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    Console.WriteLine($"{band.Name} {band.Country} {band.PlayGenre} {band.DateofCreation.ToString("yyyy/MM/dd")}");
                    Console.ResetColor();
                    Console.WriteLine();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.WriteLine($"{band.Name} {band.Country} {band.PlayGenre} {band.DateofCreation.ToString("yyyy/MM/dd")}");
                    Console.ResetColor();
                    Console.WriteLine();
                }
                counter++;
            }
        }
Beispiel #3
0
        public void PrintFormtoAddSong(DBContext context, SongEngine songEngine, BandEngine bandEngine)
        {
            Console.WriteLine("Введите название группы :");
            string bandName = Console.ReadLine();
            var    band     = bandEngine.GetBandbyName(context, bandName);

            Console.WriteLine($"Создание песни в {band.Name}");
            Console.WriteLine("Введите имя песни :");
            string name = Console.ReadLine();

            Console.WriteLine("Введите композитора :");
            string musicAuthorName = Console.ReadLine();

            Console.WriteLine("Введите автора текста :");
            string textAuthorName = Console.ReadLine();

            Console.WriteLine("Введите дату создания песни :");
            string issueDate = Console.ReadLine();
            var    song      = new Song
            {
                Name        = name,
                MusicAuthor = musicAuthorName,
                TextAuthor  = textAuthorName,
                IssueDate   = DateTime.Parse(issueDate),
                Band        = band
            };

            if (songEngine.AddSong(context, song) != false)
            {
                Console.WriteLine("Песня добавлена");
            }
            else
            {
                Console.WriteLine("Ошибка добавления");
            }
        }