Пример #1
0
 /// <summary>
 /// Method for calling methods for sorting inventory items in class pawnShop
 /// </summary>
 /// <param name="pawnShop"></object>
 static void SortInventoryItems(PawnShop pawnShop)
 {
     int option = 0;
     while (option != 99)
     {
         Console.Clear();
         Console.BackgroundColor = ConsoleColor.DarkBlue;
         Console.WriteLine("<<<<<Welcome to pawn shop sort menu>>>>>\n");
         Console.ResetColor();
         Console.WriteLine("1  :  Sort by name");
         Console.WriteLine("2  :  Sort by price");
         Console.WriteLine("99 :  Leave sort menu\n");
         Console.WriteLine("Enter your choice");
         int.TryParse(Console.ReadLine(), out option);
         switch (option)
         {
             case 1:
                 pawnShop.SortbyName();
                 Console.WriteLine("InventoryItems sorted by name!");
                 option = 99;
                 break;
             case 2:
                 pawnShop.SortbyPrice();
                 Console.WriteLine("InventoryItems sorted by price!");
                 option = 99;
                 break;
             case 99:
                 break;
             default:
                 break;
         }
         BackToMainMenuOption();
     }
 }