Esempio n. 1
0
        public IEnumerable <string> Execute(IEnumerable <string> input)
        {
            var parameters = input.ToList();

            cinemaConsole.Clear();
            cinemaConsole.WriteLineMiddle("Type a genre name:\n");

            try
            {
                var genreName = cinemaConsole.ReadLineMiddle().TrimEnd().TrimStart();
                Validations(genreName);

                genreServices.AddNewGenre(genreName);
                cinemaConsole.HandleOperation("\nSuccessfully added to database");
                return(parameters.Skip(1));
            }
            catch (InvalidClientInputException e)
            {
                cinemaConsole.HandleException(e.Message);
                return(parameters.Skip(1));
            }
            catch (EntityAlreadyExistsException e)
            {
                cinemaConsole.HandleException(e.Message);
                return(parameters.Skip(1));
            }
        }