Пример #1
0
        private void UpdateExistingEmployee()
        {
            Console.Clear();
            //Display
            DisplayAllEmployees();

            //input
            Console.WriteLine("Please enter the employee ID to be updated: ");

            //get employee
            string oldInfo = Console.ReadLine();

            //build new object
            DevPOCO newEmployee = new DevPOCO();

            //Developer ID
            Console.WriteLine("Enter the employee ID: ");
            string idAsString = Console.ReadLine();

            newEmployee.DeveloperID = int.Parse(idAsString);

            //Firstname
            Console.WriteLine("Enter the employee's First Name: ");
            newEmployee.FirstName = Console.ReadLine();

            //Lastname
            Console.WriteLine("Enter the employee's Last Name: ");
            newEmployee.LastName = Console.ReadLine();

            //pluralsight
            Console.WriteLine("Does the employee have a PluralSight account? (y/n): ");
            string pluralsight = Console.ReadLine().ToLower();

            if (pluralsight == "y")
            {
                newEmployee.PluralSightAccount = true;
            }
            else
            {
                newEmployee.PluralSightAccount = false;
            }

            //Veriry
            bool wasUpdated = _devRepo.UpdateExistingDevList(oldInfo, newEmployee);

            if (wasUpdated)
            {
                Console.WriteLine("Employee was successfully updated.");
            }
            else
            {
                Console.WriteLine("Employee could not be updated.");
            }
        }