private static async Task <int> HandleMainMenuOptionAsync(SessionContext sessionContext, AuthenticationProvider authenticationProvider, MenuOptions option) { Console.WriteLine(""); Console.WriteLine("selected option " + string.Format("{0:D} - {1}", option, option.ToName())); Console.WriteLine(""); // Display Sub Menu according to Menu Selection. switch (option) { case MenuOptions.Sales_Customers: CustomersMenuOptions customersOption = CustomersMenuOptions.Exit; do { customersOption = ConsoleHelper.GetCustomersMenuOption(); if (customersOption != CustomersMenuOptions.Exit) { await HandleCustomersOperationAsync(sessionContext, authenticationProvider, customersOption); } } while (customersOption != CustomersMenuOptions.Exit); break; case MenuOptions.Sales_SalesItems: SalesItemsMenuOptions salesItemsOption = SalesItemsMenuOptions.Exit; do { salesItemsOption = ConsoleHelper.GetSalesItemsMenuOption(); if (salesItemsOption != SalesItemsMenuOptions.Exit) { await HandleSalesItemsOperationAsync(sessionContext, authenticationProvider, salesItemsOption); } } while (salesItemsOption != SalesItemsMenuOptions.Exit); break; case MenuOptions.Sales_SalesOrders: SalesOrdersMenuOptions salesOrdersOption = SalesOrdersMenuOptions.Exit; do { salesOrdersOption = ConsoleHelper.GetSalesOrdersMenuOption(); if (salesOrdersOption != SalesOrdersMenuOptions.Exit) { await HandleSalesOrdersOperationAsync(sessionContext, authenticationProvider, salesOrdersOption); } } while (salesOrdersOption != SalesOrdersMenuOptions.Exit); break; case MenuOptions.Sales_SalesInvoices: SalesInvoicesMenuOptions salesInvoicesOption = SalesInvoicesMenuOptions.Exit; do { salesInvoicesOption = ConsoleHelper.GetSalesInvoicesMenuOption(); if (salesInvoicesOption != SalesInvoicesMenuOptions.Exit) { await HandleSalesInvoicesOperationAsync(sessionContext, authenticationProvider, salesInvoicesOption); } } while (salesInvoicesOption != SalesInvoicesMenuOptions.Exit); break; } return(0); }