コード例 #1
0
        // For example, why was I not able to call this public method directly from DevTeamRepository ?? TeamDetails(Colts);
        private void RemoveDevFromTeam()
        {
            Console.Clear();
            ViewListOfTeams();
            Console.WriteLine("From which team do you wish to remove developers?");
            string teamChoice = Console.ReadLine().ToLower();

            Console.Clear();

            int count = 0;

            foreach (DevTeam team in _devTeamRepo.GetListOfTeams())
            {
                if (teamChoice == team.TeamName.ToLower())
                {
                    _devTeamRepo.TeamDetails(teamChoice);  //print details for team
                    count++;
                }
            }
            if (count == 0)                        //condition for "if there was no teamchoice==team match"??
            {
                Console.WriteLine("Please check your spelling and try again");
                return;
            }

            _devTeamRepo.RemoveDeveloper(teamChoice);


            //print details for team
            //right here I want to call to a method to add or remove directly from list of developers on a team
        }
コード例 #2
0
        private void RemoveDevFromTeam()
        {
            Console.Clear();
            ViewListOfTeams();
            Console.WriteLine("From which team do you wish to remove developers?  Enter the index number on the left.");

            string numOfDevString = (Console.ReadLine());

            int.TryParse(numOfDevString, out int j);

            while (j <= 0 || j > _devTeamRepo._listOfTeams.Count)
            {
                Console.WriteLine("Invalid entry.  Please try again.");

                Console.WriteLine($"Enter an index number for the team to remove a developer.");

                numOfDevString = (Console.ReadLine());
                int.TryParse(numOfDevString, out j);
            }

            _devTeamRepo.RemoveDeveloper(j);
        }