Ejemplo n.º 1
0
        public static IBaseObject GetObjectBasedOnName(IGenericDao customerDao)
        {
            Console.WriteLine("Enter name of customer you want to find");
            var name            = Console.ReadLine();
            var listOfCustomers = customerDao.GetListOfObjectsByName(name);
            int i = 0;
            Dictionary <int, IBaseObject> tempDict = new Dictionary <int, IBaseObject>();

            foreach (var customer in listOfCustomers.GetUnderlyingDictionary().Values)
            {
                tempDict.Add(i, customer);
                Console.WriteLine($"{i} : {customer}");
            }
            var choice = Convert.ToInt32(Console.ReadLine());

            if (tempDict.Count >= choice)
            {
                return(null);
            }
            else
            {
                return(tempDict[choice]);
            }
        }