Exemple #1
0
        public string Execute(IEnumerable <string> parameters)
        {
            IList <string> args = parameters.ToList();

            if (args.Count != 4)
            {
                throw new InvalidBookServiceParametersExeption("Invalid numbers of parameters");
            }

            string title       = args[0];
            string genre       = args[1];
            string author      = args[2];
            string bookInStore = args[3];

            var newGenre  = genreServices.AddGenre(genre);
            var newAuthor = authorServices.AddAuthor(author);

            var addedBook = booksServices.AddBook(title, newGenre, newAuthor, bookInStore);

            return($"New book {addedBook.Title} was added.");
        }