Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        private static void EditCustomerFromID(CRMDatabase database, int customerID)
        {
            Console.Clear();
            var customer = database.GetCustomer(customerID);

            Console.WriteLine($"\nEdit customer: {customer}\n");

            var firstName = GetFirstNameFromUser();
            var lastName  = GetLastNameFromUser();
            var email     = GetEmailFromUser();

            database.EditCustomer(customerID, firstName, lastName, email);

            AddPhoneNumbers(database, customerID);
        }