// Query and process orders static void ProcessOrders(rappiHelper helper) { // Query new orders var rootOrders = helper.GetOrders().Result; // If there are no orders, exit the process if (rootOrders.Count == 0) { return; } // Loop through each order and ask the user to take or reject it foreach (var root in rootOrders) { Console.ForegroundColor = ConsoleColor.Green; // Show order Console.WriteLine($" Order id:{root.order.id}"); // Show order items foreach (var item in root.order.items) { Console.WriteLine($" {item.name} x {item.units} ${item.price}"); } // Ask user for action for this order Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" Do you want to Take (T) or Reject (R) the order"); var action = Console.ReadLine().ToUpper(); if (action == "T") { if (helper.TakeOrder(root.order.id).Result) { Console.WriteLine(" Order taken"); } } else if (action == "R") { Console.WriteLine(" Reason to reject:"); var reason = Console.ReadLine(); if (helper.RejectOrder(root.order.id, reason).Result) { Console.WriteLine(" Order rejected"); } } else { Console.WriteLine(" Order ignored"); } } }