private void AddGreeting() { Console.Clear(); Console.WriteLine("Enter Customer's First Name:"); string firstName = Console.ReadLine(); Console.WriteLine("Enter Customer's Last Name:"); string lastName = Console.ReadLine(); string customerMessage = ""; CustomerStatus customerStatus = CustomerStatus.Potential; Console.WriteLine("Please Select Customer Type:\n" + "1. Potential Customer\n" + "2. Current Customer\n" + "3. Past Customer"); string customerStatusInput = Console.ReadLine(); switch (customerStatusInput) { case "1": customerStatus = CustomerStatus.Potential; customerMessage = "We currently have the lowest rates on Helicopter Insurance!"; break; case "2": customerStatus = CustomerStatus.Current; customerMessage = "Thank you for your work with us. We appreciate your loyalty. Here's a coupon."; break; case "3": customerStatus = CustomerStatus.Past; customerMessage = "It's been a long time since we've heard from you, we want you back"; break; default: Console.WriteLine("Please enter a valid selection."); break; } CustomerInformation newGreeting = new CustomerInformation(firstName, lastName, customerStatus, customerMessage); bool contentWasAdded = _customerRepo.AddGreetingToDirectory(newGreeting); if (contentWasAdded) { Console.WriteLine("Greeting added successfully!"); } else { Console.WriteLine("Error adding greeting."); } Console.WriteLine("Press any key to continue..."); Console.ReadLine(); }
public bool AddGreetingToDirectory(CustomerInformation greeting) { int startingCount = _customerDirectory.Count; _customerDirectory.Add(greeting); bool wasAdded = (_customerDirectory.Count > startingCount); return(wasAdded); }
public void SeedContent() { CustomerInformation johnDoe = new CustomerInformation( "John", "Doe", CustomerStatus.Potential, "We currently have the lowest rates on Helicopter Insurance!"); CustomerInformation janeDoe = new CustomerInformation( "Jane", "Doe", CustomerStatus.Current, "Thank you for your work with us. We appreciate your loyalty. Here's a coupon."); CustomerInformation bobSmith = new CustomerInformation( "Bob", "Smith", CustomerStatus.Past, "It's been a long time since we've heard from you, we want you back."); _customerRepo.AddGreetingToDirectory(johnDoe); _customerRepo.AddGreetingToDirectory(janeDoe); _customerRepo.AddGreetingToDirectory(bobSmith); }