コード例 #1
0
        public KomodoInsuranceTeam UpdateTeam(KomodoInsuranceTeam teamToChange)
        {
            Console.WriteLine("Enter the new team name:");
            string newTeamName = Console.ReadLine();

            Console.WriteLine("Enter the new team ID:");
            int newID = int.Parse(Console.ReadLine());

            teamToChange.TeamName = newTeamName;
            teamToChange.IDNumber = newID;

            return(teamToChange);
        }
コード例 #2
0
        public void CreateTeams()
        {
            KomodoInsuranceTeam newTeam = new KomodoInsuranceTeam();

            Console.WriteLine("Enter the name of your new team:");
            newTeam.TeamName = Console.ReadLine();
            Console.WriteLine("Enter the ID number of your new team:");
            int idNumber = int.Parse(Console.ReadLine());

            newTeam.IDNumber = idNumber;

            bool continueToAdd = true;

            while (continueToAdd)
            {
                Console.WriteLine("Choose which Developers to add to the team");

                int count = 0;
                foreach (KomodoInsuranceDeveloper developer in _listOfDevs)
                {
                    count++;
                    Console.WriteLine($"{count}: ID: {developer.DeveloperID}\n" +
                                      $"Name: {developer.LastName}\n" +
                                      $"Has Access: {developer.HasAccess}\n");
                }

                int choice = int.Parse(Console.ReadLine());

                if (choice > 0 && choice <= count)
                {
                    newTeam.AddMember(_listOfDevs[choice - 1]);
                }
                else
                {
                    Console.WriteLine("Invalid input");
                }

                Console.WriteLine("Do you wish to continue adding members to your team? (y/n):");
                char answer = char.Parse(Console.ReadLine());
                if (answer == 'y')
                {
                    continueToAdd = true;
                }
                else
                {
                    continueToAdd = false;
                }
            }

            _listOfTeams.Add(newTeam);
        }
コード例 #3
0
        public bool DeleteTeam(KomodoInsuranceTeam teamToRemove)
        {
            bool deleteResult = _listOfTeams.Remove(teamToRemove);

            return(deleteResult);
        }