private static void FindReadersByName(IReaderService rs)
        {
            Console.Clear();
            Console.WriteLine("You have chosen finding readers by name");
            Console.Write("Input name: ");
            var str = Console.ReadLine();

            if (string.IsNullOrWhiteSpace(str))
            {
                Console.WriteLine("Bad input");
                Console.Write("Press any key to return to menu");
                Console.ReadLine();
                return;
            }

            var res = rs.FindReadersByName(str);

            if (res.Count() == 0)
            {
                Console.WriteLine("Nothing was found");
            }
            else
            {
                Console.WriteLine("\nResult\n");
                Console.WriteLine($"{"Full name",-25} | {"Ticket number",-12} | {"Phone number",-20}");

                foreach (var r in res)
                {
                    Console.WriteLine($"{r.Fullname,-25} | {r.TicketNumber,-12} | {r.Phone,-20}");
                }
            }

            Console.Write("Press any key to return to menu");
            Console.ReadLine();
        }
Exemple #2
0
        public ObservableCollection <ReaderModel> FindReadersByName(string query)
        {
            var res = _service.FindReadersByName(query);

            return(new ObservableCollection <ReaderModel>(res.Select(r => _mapper.Map(r))));
        }