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

            cinemaConsole.Clear();
            cinemaConsole.WriteLineMiddle("Type a city name:\n");
            try
            {
                var cityName = cinemaConsole.ReadLineMiddle().TrimEnd().TrimStart();
                Validations(cityName);
                cityServices.AddNewCity(cityName);
                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));
            }
        }