static void Main(string[] args) //Main Method { InterfaceHandler interfaceHandler = new InterfaceHandler(); //Creating object for the class interfaceHandler.InterfaceController(); //Calling the method from the class using object as reference Console.Read(); }
public void AdminFunction() { Product product = new Product(); try { Console.WriteLine("*********************Welcome to Admin Page*************************"); Console.WriteLine("Enter your choice\n1.Add Product\n2.Display Product \n3.Delete Product\n4.Logout"); int select = int.Parse(Console.ReadLine()); do { switch (select) { case 1: product.AddProduct(); break; case 2: product.DisplayProduct(); break; case 3: product.DeleteProductKey(); break; case 4: InterfaceHandler interfaceHandler = new InterfaceHandler(); interfaceHandler.InterfaceController(); break; } Console.WriteLine("*********************Welcome to Admin Page*************************"); Console.WriteLine("Enter your choice\n1.Add Product\n2.Display Product \n3.Delete Product\n4.Logout"); select = int.Parse(Console.ReadLine()); } while (select != 8); } catch (OverflowException) { Console.WriteLine("Invalid Input.."); AdminFunction(); } catch (FormatException) { Console.WriteLine("Invalid Input.."); AdminFunction(); } catch (Exception) { Console.WriteLine("Invalid Input.."); AdminFunction(); } }