Ejemplo n.º 1
0
        //METHODS
        public void Main()
        {
            bool   active = true;
            string choice = string.Empty;

            while (active)
            {
                Menu();
                choice = Console.ReadLine();

                switch (int.Parse(choice))
                {
                case 1:
                    NewBook();
                    break;

                case 2:
                    active = false;
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("You have choosen to quit this application...");
                    Console.ResetColor();
                    break;

                case 3:
                    ListList();
                    break;

                case 4:
                    Console.WriteLine("Enter ISBN: ");
                    string ISBN = Console.ReadLine();

                    Book searched = SearchList(ISBN);

                    if (searched != null)
                    {
                        searched.Write();
                    }
                    else
                    {
                        Console.WriteLine("Sadly, the book was not found...");
                    }
                    break;

                case 5:
                    SortListISBN();
                    break;

                case 6:
                    SortListName();
                    break;

                case 66:
                    SortListPrice();
                    break;

                case 67:
                    SortListTitle();
                    break;

                case 7:
                    ListHash();
                    break;

                case 8:
                    Console.WriteLine("Enter ISBN: ");
                    string ISBN2 = Console.ReadLine();

                    Book searched2 = SearchHash(ISBN2);

                    if (searched2 != null)
                    {
                        searched2.Write();
                    }
                    else
                    {
                        Console.WriteLine("Sadly, the book was not found...");
                    }
                    break;
                }

                Console.ReadKey();
                Console.Clear();
            }
        }