private static void AgencyBusinessLogicMenu() { AgencyLogic agencyLogic = new AgencyLogic(); Console.Clear(); Console.WriteLine("Choose an action:"); Console.WriteLine("1) List all agencies"); Console.WriteLine("2) Update agency"); Console.WriteLine("3) Create new agency"); Console.WriteLine("4) Delete agency"); Console.WriteLine("5) Show more successful agencies"); Console.WriteLine("6) Show num of applicants of agency"); Console.Write("\r\nSelect an option: "); switch (Console.ReadLine()) { case "1": Console.WriteLine("Table agency:"); foreach (Agency item in agencyLogic.GetAllAgencies().ToList()) { Console.WriteLine($"agen_id: {item.AgenId}, agen_name: {item.AgenName}, agen_address: {item.AgenAddress}, agen_email: {item.AgenEmail}"); } Console.ReadLine(); break; case "2": Console.WriteLine("Update agency:"); Console.WriteLine("Type id of the agency which needs to modify:"); int takeId = int.Parse(Console.ReadLine()); Console.WriteLine("Type contact email address of the agency"); string newMail = Console.ReadLine(); agencyLogic.ChangeAgencyEmail(takeId, newMail); break; case "3": try { Console.WriteLine("Create new travel agency"); Console.WriteLine("Create new id (id should be more than 7):"); int newId = int.Parse(Console.ReadLine()); Console.WriteLine("Create a name of agency:"); string newName = Console.ReadLine(); Console.WriteLine("Write a location of the agency"); string newgender = Console.ReadLine(); Console.WriteLine("Enter new email address: "); string newEmail = Console.ReadLine(); agencyLogic.CreateNewAgency(newId, newName, newgender, newEmail); } catch (Exception ex) { string message = string.Empty; Console.ForegroundColor = ConsoleColor.Red; if (ex is FormatException) { message = " Incorrect form"; } else { Console.WriteLine(ex.Message); } Console.WriteLine(message); } break; case "4": Console.WriteLine("Delete agency by id:"); Console.WriteLine("Enter id:"); int delId = int.Parse(Console.ReadLine()); agencyLogic.DeleteAgency(delId); Console.WriteLine("Agency deleted successfully!"); break; case "5": Console.WriteLine("Show agency successful visas"); var successAg = agencyLogic.GetAgencyWithApprovedVisas(); foreach (var v in successAg) { Console.WriteLine($" AgName: {v.AgenName}, IsApproved:{v.Approved}, ClientJob: {v.Job}, ClientName:{v.ClientName} "); } Console.WriteLine("task output:"); Task <IList <AgencySuccessful> > agTask = agencyLogic.GetAgencyWithApprovedVisasAsync(); agTask.Wait(); if (agTask.IsCompletedSuccessfully) { foreach (var task in agTask.Result) { Console.WriteLine($" AgName: {task.AgenName}, IsApproved:{task.Approved}, ClientJob: {task.Job}, ClientName:{task.ClientName}"); } } Console.ReadLine(); break; case "6": Console.WriteLine("Show number of applicants for the specified agency ...enter name:(eg. TravelAround, CCUnated)"); string newname = Console.ReadLine(); var agencyWanted = agencyLogic.GetAgencyByName(newname); Console.WriteLine($" AgName: {agencyWanted.AgenName}, NumberOfApplicants:{agencyWanted.Number} "); Console.ReadLine(); break; } }