/// <summary> /// Handles displaying the order history of a given location ID. /// </summary> private static void HandleRequestDisplayOrderHistoryOfLocation() { Log.Information("Handling request displaying order history of location"); Console.WriteLine("[?] What is the location ID"); string inputLocationId = Console.ReadLine(); Log.Information($"User entered '{inputLocationId}' for location id"); if (!Int32.TryParse(inputLocationId, out int locationId)) { throw new FormatException("[!] Input for location ID is not an integer"); } if (LocationData.GetLocationWithId(locationId) is null) { throw new BusinessLocationException($"[!] Location {locationId} does not exist"); } ICollection <BusinessOrder> ordersWithLocation = OrderData.GetOrdersWithLocationId(locationId); Console.WriteLine($"[*] There are {ordersWithLocation.Count} orders for location {locationId}"); ordersWithLocation.ToList().ForEach(o => Console.WriteLine(o)); Console.WriteLine(); }