Beispiel #1
0
        public void Exe()
        {
            Console.Clear();
            Console.WriteLine(ConsoleIO.SeparationBar);
            Contacts contacts1 = new Contacts();

            contacts1.FirstName = ConsoleIO.GetRequiredStringFromUser("First Name: ");
            contacts1.LastName  = ConsoleIO.GetRequiredStringFromUser("Last Name: ");
            contacts1.Company   = ConsoleIO.GetRequiredStringFromUser("Company: ");
            contacts1.Title     = ConsoleIO.GetRequiredStringFromUser("Title");

            Console.WriteLine();
            if (ConsoleIO.GetYesNoFromUser("Add the following info: ") == "Y")
            {
                contactsRepository.Add(contacts1);
                Console.WriteLine("Contact Added");
                Console.WriteLine("Press any key to continue....");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Action Cancelled");
                Console.WriteLine("Press any key to continue....");
                Console.ReadKey();
            }


            ListWorkflow lwf = new ListWorkflow();

            lwf.Exe();
        }
Beispiel #2
0
        public void Exe()
        {
            Console.Clear();

            ListWorkflow lwf = new ListWorkflow();

            lwf.Exe();

            Console.WriteLine(ConsoleIO.SeparationBar);

            Console.WriteLine("Select ID to remove");

            int id = Convert.ToInt32(Console.ReadLine());

            contactsRepository.Delete(id);
            Contacts removedContact = contactsRepository.GetById(2);

            if (removedContact == null)
            {
                Console.WriteLine("Record already removed...");
            }

            lwf.Exe();
        }
        public void Exe()
        {
            int    id;
            int    ch;
            string Name;

            Console.WriteLine(ConsoleIO.SeparationBar);

            ListWorkflow lwf = new ListWorkflow();

            lwf.Exe();

            Console.WriteLine("Which ID do you want to edit?");
            id = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Select the one you want to edit: ");
            Console.WriteLine("1. First Name: ");
            Console.WriteLine("2. Last Name: ");
            Console.WriteLine("3. Company: ");
            Console.WriteLine("4. Title: ");
            ch = Convert.ToInt32(Console.ReadLine());

            Contacts contacts = contactsRepository.GetById(id);

            Name = null;

            switch (ch)
            {
            case 1:
                Console.WriteLine("First Name: ");
                string fname = Console.ReadLine();
                contacts.FirstName = fname;
                Name = "FirstName";
                contactsRepository.Update(contacts, Name);
                GetByID(id);
                break;

            case 2:
                Console.WriteLine("Last Name: ");
                string lname = Console.ReadLine();
                contacts.LastName = lname;
                Name = "LastName";
                contactsRepository.Update(contacts, Name);
                GetByID(id);
                break;

            case 3:
                Console.WriteLine("Company: ");
                string company = Console.ReadLine();
                contacts.Company = company;
                Name             = "Company";
                contactsRepository.Update(contacts, Name);
                GetByID(id);
                break;

            case 4:
                Console.WriteLine("Title: ");
                string title = Console.ReadLine();
                contacts.Title = title;
                Name           = "Title";
                contactsRepository.Update(contacts, Name);
                GetByID(id);
                break;

            default:
                Console.WriteLine("Please make a selection: ");
                break;
            }
        }