Beispiel #1
0
        //temat5/zadanie3
        public void AddEmployeeDemo()
        {
            var id = ListOfEmployees.Count + 1;

            Console.Write("Enter first name: ");
            var firstName = Console.ReadLine();

            Console.Write("Enter last name: ");
            var lastName = Console.ReadLine();

            Console.Write("Enter age: ");
            var age = Convert.ToInt32(Console.ReadLine());

            foreach (var employee in ListOfEmployees)
            {
                if (employee.FirstName == firstName && employee.LastName == lastName)
                {
                    Console.WriteLine("User already exists.");
                }
                return;
            }

            ListOfEmployees.Add(EmployeeFactory.CreateEmployee(id, firstName, lastName, age));
        }
Beispiel #2
0
 //temat5/zadanie2
 public void AddEmployee()
 {
     ListOfEmployees.Add(EmployeeFactory.CreateEmployee());
 }