public static void Add() { string firstName, lastName, city, country, phone; //string ? NullInput = null; Console.WriteLine("Input New Customer Info:"); Console.WriteLine("First Name:"); firstName = Console.ReadLine(); while (string.IsNullOrEmpty(firstName) || string.IsNullOrWhiteSpace(firstName)) { Console.WriteLine("Please Enter A valid Input For FirstName(Cannot be empty)"); firstName = Console.ReadLine(); } Console.WriteLine("Last Name"); lastName = Console.ReadLine(); while (string.IsNullOrEmpty(lastName) || string.IsNullOrWhiteSpace(lastName)) { Console.WriteLine("Please Enter A valid Input For LastName(Cannot be empty)"); lastName = Console.ReadLine(); } Console.WriteLine("City"); city = Console.ReadLine(); Console.WriteLine("Country"); country = Console.ReadLine(); Console.WriteLine("Phone"); phone = Console.ReadLine(); CustCRUD.AddCust(firstName, lastName, city, country, phone); ShowAllCustomers(); }
public static void ShowAllCustomers() { foreach (var c in CustCRUD.GetAllCustomers()) { Console.WriteLine(c.ToString()); } }
public static void Delete() { Console.WriteLine("Enter the last name of the Customer you want to delete"); string LastName = Console.ReadLine(); CustCRUD.DelCust(LastName); Console.WriteLine($"Customer With Last Name {LastName} removed from records"); ShowAllCustomers(); }
public static void Update() { Console.WriteLine("Enter The last name of the customer to update"); string lastName = Console.ReadLine(); CustCRUD.UpdateCust(lastName); Console.WriteLine($"Customer With Last Name {lastName} updated"); ShowAllCustomers(); }
public static void Find() { Console.WriteLine("Enter the last name of the customer you want to find"); string lastName = Console.ReadLine(); foreach (string cust in CustCRUD.FindCust(lastName)) { Console.WriteLine(cust); } }
public static void Filter() { Console.WriteLine("Please Enter Type of filter (C)ity, (L)astName, or Starting (CH)arcter of LastName \nOr leave blank to Find by lastName"); string Type = Console.ReadLine(); Console.WriteLine("Enter the filter parameter"); string Filter = Console.ReadLine(); if (string.IsNullOrWhiteSpace(Filter) || string.IsNullOrEmpty(Filter)) { Find(); } else { foreach (var cust in CustCRUD.FilterCust(Type, Filter)) { Console.WriteLine(cust); } } }