private Souce orderOneTypeOfSouce(Souce souce) { Console.WriteLine(); Console.WriteLine("Please type the name of the souce."); string souceName = Console.ReadLine(); souce = souce.getSouce(souceName); while (souce == null) { Console.WriteLine("Wrong souce. Type again."); souceName = Console.ReadLine(); souce = new Souce(); souce = souce.getSouce(souceName); } Console.WriteLine(); Console.WriteLine("How many " + souceName + " souces?"); string souceNumber = Console.ReadLine(); int number = getNumberOfItems(ref souceNumber); souce.no = number; return(souce); }
private void takePizzaOrder(Order order, ref Pizza pizza, ref string response) { if (isPositiveResponse(response)) { pizza = orderOneTypeOfPizza(pizza); order.pizzas.Add(pizza); while (isPositiveResponse(response)) { Console.WriteLine("Do you want to order another pizza? (Y/N)"); response = Console.ReadLine(); if (isPositiveResponse(response)) { pizza = orderOneTypeOfPizza(pizza); order.pizzas.Add(pizza); } } } Console.WriteLine(); Console.WriteLine("Do you want to order souce for your pizza? (Y/N)"); Souce souce = new Souce(); souce.displaySouceNameAndPrice(); Console.WriteLine(); response = Console.ReadLine(); if (isPositiveResponse(response)) { souce = orderOneTypeOfSouce(souce); order.souces.Add(souce); while (isPositiveResponse(response)) { Console.WriteLine("Do you want to order another souce? (Y/N)"); response = Console.ReadLine(); if (isPositiveResponse(response)) { souce = orderOneTypeOfSouce(souce); order.souces.Add(souce); } } } }