private static void RemoveCustomer(CRMDatabase database) { Console.Clear(); DisplayAllCustomers(database); Console.Write("\nEnter ID for customer to remove: "); int.TryParse(Console.ReadLine(), out var customerID); if (database.IsValidCustomerID(customerID)) { var customer = database.GetCustomer(customerID); database.DeleteCustomer(customerID); WriteLineColor($"Removed customer {customer}", ConsoleColor.Red); } else if (customerID == 0) { return; } else { WriteLineColor("There is no customer with that ID", ConsoleColor.Red); } PressAnyKeyToContinue(); }
private static void EditCustomer(CRMDatabase database) { Console.Clear(); DisplayAllCustomers(database); var customerID = GetCustomerToEditFromUser(); if (database.IsValidCustomerID(customerID)) { EditCustomerFromID(database, customerID); } else if (customerID == 0) { return; } else { WriteLineColor("There is no customer with that ID", ConsoleColor.Red); } PressAnyKeyToContinue(); }
private static void AddPhoneNumbers(CRMDatabase database) { DisplayAllCustomers(database); Console.Write("Enter ID for customer to add phone numbers to: "); int.TryParse(Console.ReadLine(), out var customerID); if (database.IsValidCustomerID(customerID)) { AddPhoneNumbers(database, customerID); } else if (customerID == 0) { return; } else { WriteLineColor("There is no customer with that ID", ConsoleColor.Red); } PressAnyKeyToContinue(); }