// Method which holds the interface for adding a customer to the crm file public void NewCustomerSubmenu(bool clear = true) { if (clear) { Console.Clear(); } Console.WriteLine("### New Customer Submenu ###\n"); Console.WriteLine("Please fill the following fields (fields with * are required)\n"); Console.Write("Title*: "); title = StringToTitleCase(Console.ReadLine()); Console.Write("FirstName*: "); firstName = StringToTitleCase(Console.ReadLine()); Console.Write("LastName*: "); lastName = StringToTitleCase(Console.ReadLine()); GenderValidationInput(); DOBValidationInput(); // Determine the highest ID number in the list int HighestID; // if the list has any customer, we determine the max ID using the max method on the list of objects if (Crm.CustomerList.Count() > 0) { HighestID = Crm.CustomerList.Max(Customer => Customer.ID); }// If the list has no customers, we make the id to be -1, so when the first customer is added, it will // increment by one, which will be 0 (-1 + 1 = 0). else { HighestID = -1; } // The customer id number must be unqiue, so we will make it equal to the highest ID number in the crm list and // increment it by one int CustomerIDNumber = HighestID + 1; // Add new customer Customer newCustomer = new Customer(CustomerIDNumber, title, firstName, lastName, Gender, DOB); if (Crm.AddCustomer(newCustomer)) { Console.Write("\nSuccessfully created new customer '{0} - {1} {2} {3}' and added to customer list", CustomerIDNumber, title, firstName, lastName); Crm.SaveToFile(); } // If user presses any key, prompt the end of the menu LastMRRCscreen(() => SubMenu("Customer"), () => NewCustomerSubmenu()); }