예제 #1
0
        public static int DisplayMenu(ApeService apeService)
        {
            Console.WriteLine("");
            Console.WriteLine("--------------------------------");
            Console.WriteLine("Welcome to Shan Family Tree");
            Console.WriteLine("These are the total list of apes , please use exact names");
            foreach (Ape ape in apeService.GetAll())
            {
                Console.Write(ape.GetName() + $"\t");
            }
            Console.WriteLine();
            Console.WriteLine("These are the total list of Relations , please use exact names");
            foreach (var relationship in Enum.GetNames(typeof(RelationshipType)))
            {
                Console.Write(relationship + $"\t");
            }

            Console.WriteLine();
            Console.WriteLine("1. Get Relations of Ape");
            Console.WriteLine("2. Add a NewBorn into Family");
            Console.WriteLine("3. Find Mother with Maximum number of Girl Childs");
            Console.WriteLine("4. Find Relation between two Apes");
            Console.WriteLine("5. Exit");
            var result = Console.ReadLine();
            int input;

            if (Int32.TryParse(result, out input))
            {
                return(input);
            }
            return(5);
        }