Example #1
0
        private void CreateANewDevTeam()
        {
            Console.Clear();
            bool hasEnlistedAllMembers = false;

            GenerateMenuTitle("Create Dev Team");
            DevTeam devTeam = new DevTeam();

            AskQuestion("Please input a team name");
            string userinputTeamName = Console.ReadLine();

            devTeam.TeamName = userinputTeamName;

            AskQuestion("Select Team Department\n" +
                        "1. SoftwareDevs\n" +
                        "2. Marketing\n" +
                        "3. GruntWorkers\n");

            int             userInputTeamDepartments = int.Parse(Console.ReadLine());
            TeamDepartments uITDConversion           = (TeamDepartments)userInputTeamDepartments;

            devTeam.TeamDepartment = uITDConversion;


            //this is where we add Devs to the team
            while (hasEnlistedAllMembers == false)
            {
                AskQuestion("Do You have any team members?(y/n)");

                string userInputHaveTeamMembers = Console.ReadLine().ToLower();

                if (userInputHaveTeamMembers == "y")
                {
                    Console.Clear();
                    AskQuestion("Who do you want on your team?");
                    ShowDevs();

                    int       userInputSelection = int.Parse(Console.ReadLine());
                    Developer selectedDeveloper  = _devRepo.GetDeveloperById(userInputSelection);
                    devTeam.Developers.Add(selectedDeveloper);
                }
                else if (userInputHaveTeamMembers == "n")
                {
                    hasEnlistedAllMembers = true;
                    Console.WriteLine($"Members Added: {devTeam.Developers.Count}");
                    Console.ReadKey();
                }
                else
                {
                    Console.WriteLine("Invalid Opperation");
                    Console.ReadKey();
                }
            }

            _devTeamRepo.AddTeamToDatabase(devTeam);

            Console.ReadKey();
        }