public static void LogInMenu()
 {
     while (true)
     {
         Console.Clear();
         Console.WriteLine("1.Login as customer.");
         Console.WriteLine("2.Login as admin.");
         Console.WriteLine("3.Exit");
         Console.WriteLine("Make your choice");
         int choice = MakeChoice(1, 3);
         if (choice == 3) return;
         Console.WriteLine("Enter username:"******"Enter password");
         string password = Console.ReadLine();
         switch (choice)
         {
             case 1: // Login as customer
                 {
                     try
                     {
                         Customer customer = new Customer(username, password);
                         customer = (Customer)customer.LogIn();
                         if (customer != null)
                         {
                             Console.WriteLine("Logged in successful.");
                             CustomerMenu(customer);
                         }
                     }
                     catch (ArgumentException ae)
                     {
                         Console.WriteLine(ae.Message);
                     }
                     catch (Exception e)
                     {
                         Console.WriteLine(e.Message);
                     }
                     break;
                 }
             case 2: // Login as admin
                 {
                     try
                     {
                         Admin admin = new Admin(username, password);
                         admin = (Admin)admin.LogIn();
                         if (admin != null)
                         {
                             Console.WriteLine("Logged in successful.");
                             AdminMenu(admin);
                         }
                     }
                     catch (ArgumentException ae)
                     {
                         Console.WriteLine(ae.Message);
                     }
                     catch (Exception ex)
                     {
                         Console.WriteLine(ex.Message);
                     }
                     break;
                 }
         }
     }
 }
 public static void Register(string username, string password)
 {
     Customer customer = new Customer(username, password);
     ShopInformation.Customers.Add(customer);
 }
 private static void CustomerMenu(Customer user)
 {
     while (true)
     {
         Console.Clear();
         Console.WriteLine("1.Add product to cart.");
         Console.WriteLine("2.Remove product from cart.");
         Console.WriteLine("3.View products in cart.");
         Console.WriteLine("4.Empty cart.");
         Console.WriteLine("5.Buy products in cart.");
         Console.WriteLine("6.Logout.");
         Console.WriteLine("Make your choice");
         int choice = MakeChoice(1, 6);
         switch (choice)
         {
             case 1: // add product to cart
                 {
                     Console.WriteLine(ShopInformation.PrintAvailableProducts());
                     try
                     {
                         Console.WriteLine("Choose product ID:");
                         int id = int.Parse(Console.ReadLine());
                         Console.WriteLine("Enter quantity:");
                         int quantity = int.Parse(Console.ReadLine());
                         user.AddNewItemToCart(id, quantity);
                     }
                     catch (ProductNotAvailableException pnae)
                     {
                         Console.WriteLine(pnae.Message);
                     }
                     PressAnyKey();
                     break;
                 }
             case 2://remove product from cart
                 {
                     Console.WriteLine(user.Cart.CartList);
                     Console.WriteLine("Choose product ID:");
                     int id = int.Parse(Console.ReadLine());
                     user.RemoveItemFromCart(id);
                     PressAnyKey();
                     break;
                 }
             case 3: // view products in cart
                 {
                     Console.WriteLine(user.Cart.CartList);
                     PressAnyKey();
                     break;
                 }
             case 4: // empty cart
                 {
                     user.EmptyCart();
                     Console.WriteLine("Cart is empty.");
                     PressAnyKey();
                     break;
                 }
             case 5: // Buy products in cart
                 {
                     user.BuyCart();
                     PressAnyKey();
                     break;
                 }
             case 6:
                 {
                     user.LogOut();
                     return;
                 }
         }
     }
 }