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,
                        commandWords[6],
                        int.Parse(commandWords[7]));
                    this.InsertAlbum(album, performer);
                    break;
                default:
                    base.ExecuteInsertMediaCommand(commandWords);
                    break;
            }
        }
Exemplo n.º 2
0
 private void InsertAlbum(Album album, IPerformer performer)
 {
     this.media.Add(album);
     this.mediaSupplies.Add(album, new SalesInfo());
     this.Printer.PrintLine("Album {0} by {1} added successfully", album.Title, performer.Name);
 }