Example #1
0
 public void Run(string command)
 {
     OutletSearchCLI.WriteMessage("*******************************", OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage("*   News Outlet Search Help   *", OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage("*                             *", OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage("* 1. Enter search term(s)     *", OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage(string.Format(@"* 2. Type ""{0}"" to clear      *", OutletSearchCLIConstants.Commands.Clear), OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage(string.Format(@"* 3. Type ""{0}"" to exit      *", OutletSearchCLIConstants.Commands.Exit), OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage(string.Format(@"* 4. Type ""{0}"" for options  *", OutletSearchCLIConstants.Commands.Help), OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage("*                             *", OutletSearchCLIConstants.Colors.SystemMessage);
     OutletSearchCLI.WriteMessage("*******************************", OutletSearchCLIConstants.Colors.SystemMessage);
 }
Example #2
0
        public void Run(string command)
        {
            var results = repository.SearchContacts(command);

            Console.WriteLine();
            OutletSearchCLI.WriteMessage("*******************", OutletSearchCLIConstants.Colors.SystemMessage);
            OutletSearchCLI.WriteMessage("* Search Results: *", OutletSearchCLIConstants.Colors.SystemMessage);
            OutletSearchCLI.WriteMessage("*******************", OutletSearchCLIConstants.Colors.SystemMessage);
            Console.WriteLine();

            if (!results.Any())
            {
                OutletSearchCLI.WriteMessage("No contacts found", OutletSearchCLIConstants.Colors.SystemMessage);
                Console.WriteLine();
                return;
            }

            var allOutlets = repository.All();

            for (int i = 0; i < results.Count(); i++)
            {
                SimpleConsoleHighlighter.RenderContact(results[i], i, allOutlets.First(x => x.Id == results[i].OutletId), command);
            }
        }