Example #1
0
        public void AddCustomer(Customer newCustomer)
        {
            List <Customer> getCustomers = repo.GetAllCustomers();

            foreach (var customer in getCustomers)
            {
                if (customer.Name.Equals(newCustomer.Name))
                {
                    Log.Error($"Customer already exists. Name: {newCustomer.Name}");
                    throw new Exception($"\nCustomer name {newCustomer.Name} already exists. Not you? Please enter a unique name.");
                }
            }
            repo.AddACustomer(newCustomer);
        }