Ejemplo n.º 1
0
        public static void ManageMusicData()
        {
            MusicService service = new MusicService(new Model3Container());
            String       response;
            String       option;

            Console.WriteLine("Options:");
            Console.WriteLine("Add Artist");
            Console.WriteLine("Add Album");
            Console.WriteLine("Add Relationship");

            while (true)
            {
                Console.Write("Continue?[Y\\N]");
                response = Console.ReadLine();
                if (response != "Y")
                {
                    break;
                }
                Console.Write("Pick an option:");
                option = Console.ReadLine();
                if (option == "Add Artist")
                {
                    String first;
                    String last;
                    Console.Write("First Name:");
                    first = Console.ReadLine();
                    Console.Write("Last Name:");
                    last = Console.ReadLine();
                    Artist a = new Artist()
                    {
                        FirstName = first, LastName = last
                    };
                    service.AddArtist(a);
                }
                else if (option == "Add Album")
                {
                    String name;
                    Console.Write("Album Name:");
                    name = Console.ReadLine();
                    Album a = new Album()
                    {
                        AlbumName = name
                    };
                    service.AddAlbum(a);
                }
                else if (option == "Add Relationship")
                {
                    int artistID;
                    int albumID;
                    Console.Write("Artist ID:");
                    artistID = Int32.Parse(Console.ReadLine());
                    Console.Write("Album ID:");
                    albumID = Int32.Parse(Console.ReadLine());
                    if (!service.BindAlbumAndArtist(albumID, artistID))
                    {
                        Console.WriteLine("Invalid Album or Artist ID");
                    }
                }
                else
                {
                    Console.WriteLine("Invalid Option");
                }
            }
        }