public void Pay() { CalculateTotal(); TotalOrder = Math.Round(TotalOrder, 2); var header = new HeaderBar(64); header.DrawCheckout(this); // Console.WriteLine($"Your grand total is: {TotalOrder}"); while (true) { Console.WriteLine($"How would you like to pay for your order? Please select options 1-3: \n1 - Cash, 2 - Credit/Debit, 3 - Check"); //*** Maybe no need for Enum Payment Type, just ask for an int and switch should follow?*** var paymentType = int.TryParse(Console.ReadLine(), out int result); //while (!int.TryParse(Console.ReadLine(), out int PaymentType)) //{ // Console.WriteLine("Invalid Option, try again."); // paymentType = Console.ReadLine(); //} PaymentType = result; switch (result) { case 1: PayCash(); return; case 2: PayCredit(); return; case 3: PayCheck(); return; default: Console.WriteLine("Unknown Payment Type."); break; } Console.Write("Input error: Please try again: "); } }
public void Pay() { if (OrderList.Count == 0) { Console.WriteLine("Nothing in cart! Returning to main menu: "); Console.ReadKey(); return; } CalculateTotal(); TotalOrder = Math.Round(TotalOrder, 2); var header = new HeaderBar(64); header.DrawCheckout(this); header.DrawPaymentOptions(); while (true) { var paymentType = Common.GetInt(1, 3); PaymentType = paymentType; switch (paymentType) { case 1: PayCash(); return; case 2: PayCredit(); return; case 3: PayCheck(); return; default: Console.WriteLine("Unknown Payment Type."); break; } Console.Write("Input error: Please try again: "); } }