Beispiel #1
0
        public static void RunAdminPath(INegativeWordsApiService apiService, IUserInputProcessor userInputProcessor)
        {
            Console.WriteLine($"Please select action - R - to read current negative word, A to add new negative words or D to remove existing negative word.");
            var action = Console.ReadLine();

            switch (action.ToUpper())
            {
            case "A":
            {
                Console.WriteLine($"Please type in new word.");
                var newWord = Console.ReadLine();
                apiService.AddNegativeWords(newWord.ToLower());

                Console.WriteLine($"Current words library: ");
                var words = apiService.GetNegativeWordsAsync();
                words.ForEach(x => Console.WriteLine($"{x}"));

                break;
            }

            case "D":
            {
                var currentWords = apiService.GetNegativeWordsAsync();
                Console.WriteLine($"You can remove words from below list of {currentWords.Count}: ");
                currentWords.ForEach(x => Console.WriteLine($"{x}"));

                Console.WriteLine($"Please type word to remove.");
                var word = Console.ReadLine();
                apiService.RemoveNegativeWords(word.ToLower());

                var words = apiService.GetNegativeWordsAsync();
                Console.WriteLine($"Current words library cointains {words.Count} words: ");
                words.ForEach(x => Console.WriteLine($"{x}"));
                break;
            }

            case "R":
            {
                var words = apiService.GetNegativeWordsAsync();
                words.ForEach(x => Console.WriteLine($"{x}"));
                break;
            }

            default:
                break;
            }

            GetUserInputWithoutFilter(userInputProcessor);
        }
 public UserInputProcessor(INegativeWordsApiService apiService)
 {
     _apiService = apiService;
 }
Beispiel #3
0
 public ContentConsoleProcessor(IUserInputProcessor processor, INegativeWordsApiService apiService)
 {
     _processor  = processor;
     _apiService = apiService;
 }