public async Task RunAsync() { Console.WriteLine("Please input number of passengers: "); string passengerStr = Console.ReadLine(); if (!int.TryParse(passengerStr, NumberStyles.AllowThousands, CultureInfo.CurrentCulture.NumberFormat, out int passengers)) { Console.WriteLine("Invalid number of passengers"); ExitApplication(); return; } Console.WriteLine("Processing...."); var starships = await _service.GetStarshipsByAllowedPassengersCount(passengers); if (starships == null) { Console.WriteLine($"No starship found that can carry {passengers} passengers"); ExitApplication(); return; } foreach (var starship in starships) { var pilotsName = starship.PilotsName.Any() ? String.Join(",", starship.PilotsName) : "No Pilot"; Console.WriteLine($"{starship.StarshipName} - {pilotsName}"); } ExitApplication(); }