Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 public static void ShowAllCustomers()
 {
     foreach (var c in CustCRUD.GetAllCustomers())
     {
         Console.WriteLine(c.ToString());
     }
 }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
                }
            }
        }