示例#1
0
        public static void ProduceAnAlbum()
        {
            var db = new Models.DatabaseContext();

            Console.WriteLine("");
            Console.WriteLine("What is the name of the album you would like to add?");
            var title = Console.ReadLine().ToLower();

            Console.WriteLine("");
            Console.WriteLine("Is this an explicit album? (yes) or (no)");
            var userInput  = Console.ReadLine().ToLower();
            var isExplicit = false;

            if (userInput == "yes")
            {
                isExplicit = true;
            }

            else
            {
                isExplicit = false;
            }
            Console.WriteLine("What is the release date of the album?, (yyyy, mm, dd)");
            var releaseDate = DateTime.Parse(Console.ReadLine().ToLower());

            Console.WriteLine("Which band is producing this album?, please select the id located to the left of the band");
            var displayBands = db.Bands;

            foreach (var b in displayBands)
            {
                Console.WriteLine($"{b.Id} {b.Name}");
            }
            var bandId = int.Parse(Console.ReadLine());
            var album  = new Models.Album
            {
                Title       = title,
                IsExplicit  = isExplicit,
                ReleaseDate = releaseDate,
                BandId      = bandId
            };

            db.Albums.Add(album);
            db.SaveChanges();

            var albumId = album.Id;

            ProduceASong(albumId);
        }
示例#2
0
        public void SignNewBand(string name, string origin, string numberOfMembers, string website, string style, string poc, string contactNumber)
        {
            var db   = new Models.DatabaseContext();
            var band = new Models.Band

            {
                Name               = name,
                CountryOfOrigin    = origin,
                NumberOfMembers    = numberOfMembers,
                Website            = website,
                Style              = style,
                IsSigned           = true,
                PersonOfContact    = poc,
                ContactPhoneNumber = contactNumber
            };

            db.Bands.Add(band);
            db.SaveChanges();
        }
示例#3
0
        public static void ProduceASong(int albumId)
        {
            var db       = new Models.DatabaseContext();
            var addSongs = true;

            while (addSongs)
            {
                Console.WriteLine("Would you like to add a song to the album? (yes) or (no)");
                var input = Console.ReadLine().ToLower();
                if (input == "yes")
                {
                    Console.WriteLine("");
                    Console.WriteLine("What is the name of the you would like to add song");
                    var title = Console.ReadLine().ToLower();
                    Console.WriteLine("");
                    Console.WriteLine("Input a few lyrics from the song");
                    var lyrics = Console.ReadLine().ToLower();
                    Console.WriteLine("");
                    Console.WriteLine("How many minutes is the song?, please round to the nearest minute");
                    var length = Console.ReadLine().ToLower();
                    Console.WriteLine("");
                    Console.WriteLine("Please input one genre for the song");
                    var genre = Console.ReadLine().ToLower();



                    var song = new Models.Song
                    {
                        Title   = title,
                        Lyrics  = lyrics,
                        Length  = length,
                        Genre   = genre,
                        AlbumId = albumId
                    };
                    db.Songs.Add(song);
                    db.SaveChanges();
                }
                if (input == "no")
                {
                    addSongs = false;
                }
            }
        }