Ejemplo n.º 1
0
        // Task 3.2
        private void HandleSearch()
        {
            Console.WriteLine();
            Console.WriteLine($"Write part or the whole name of the vehicle, and click enter.");

            if (GetInput(out var text))
            {
                return;
            }

            var result = Vehicles.FindElements(inputs =>
            {
                var output = inputs.Where(x => x.GetType().Name.ToLowerInvariant().Contains(text.ToLowerInvariant()))
                             .ToList();
                return(output);
            });

            var enumerable = result.ToList();

            if (enumerable.Count != 0)
            {
                WriteVehicles(enumerable);
            }
            else
            {
                Console.WriteLine($"No results was found from the search :(");
            }
        }