コード例 #1
0
        // Update Developers
        private void UpdateDevelopers()
        {
            ViewAllDevelopers();

            Console.WriteLine("Enter full name of developer you want to update");

            string oldDeveloper = Console.ReadLine();

            DeveloperContent newDeveloper = new DeveloperContent();

            Console.Clear();
            Console.WriteLine("Enter developer's full name");
            newDeveloper.FullName = Console.ReadLine();

            Console.WriteLine("Enter developer's ID number (numbers only)");
            newDeveloper.IdNum = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Does developer have access to Pluralsight (y/n)?");
            string hasPluralsight = Console.ReadLine().ToLower();

            if (hasPluralsight == "y")
            {
                newDeveloper.HasPluralsight = true;
                Console.WriteLine("Developer successfully added. Press enter to return to menu.");
                Console.ReadLine();
            }
            else
            {
                newDeveloper.HasPluralsight = false;
                Console.WriteLine("Developer successfully added. Press enter to return to menu.");
                Console.ReadLine();

                bool wasUpdated = _developerRepo.UpdateDeveloper(oldDeveloper, newDeveloper);
                if (wasUpdated)
                {
                    Console.WriteLine("Developer was updated");
                }
                else
                {
                    Console.WriteLine("Developer was not updated");
                }
            }
        }