Ejemplo n.º 1
0
        protected override void ExecuteInsertMediaCommand(string[] commandWords)
        {
            switch (commandWords[2])
            {
                case "album":
                    var performer = this.performers.FirstOrDefault(p => p.Name == commandWords[5]);
                    if (performer == null)
                    {
                        this.Printer.PrintLine("The performer does not exist in the database.");
                        return;
                    }

                    var album = new Album(
                        commandWords[3],
                        decimal.Parse(commandWords[4]),
                        performer.Name,
                        commandWords[6],
                        int.Parse(commandWords[7]));
                    this.InsertAlbum(album, performer);
                    break;
                default:
                    base.ExecuteInsertMediaCommand(commandWords);
                    break;
            }
        }
Ejemplo n.º 2
0
 private void InsertAlbum(Album album, IPerformer performer)
 {
     album.Performer = performer;
     this.media.Add(album);
     this.mediaSupplies.Add(album, new SalesInfo());
     // performer.Songs.Add(album);
     this.Printer.PrintLine("Album {0} by {1} added successfully", album.Title, performer.Name);
 }