예제 #1
0
        /// <summary>
        /// Saving new Team to database
        /// </summary>
        /// <param name="user"></param>
        /// <param name="teamManager"></param>
        /// <param name="stadiumManager"></param>
        /// <param name="playerManager"></param>
        /// <param name="playerSkillManager"></param>
        /// <param name="nationManager"></param>
        /// <param name="coachManager"></param>
        /// <param name="coachSkillManager"></param>
        /// <returns></returns>
        public static Team CreateFinishedTeam(
            User user,
            TeamManager teamManager,
            StadiumManager stadiumManager,
            PlayerManager playerManager,
            PlayerSkillManager playerSkillManager,
            NationManager nationManager
            // CoachManager coachManager,
            //CoachSkillManager coachSkillManager

            )
        {
            Team team = CreateTeam(user);

            // coachSkillManager.Add(team.Coach.CoachSkill);
            //coachSkillManager.Save();
            //  coachManager.Add(team.Coach);
            //coachManager.Save();

            stadiumManager.Add(team.Stadium);
            stadiumManager.Save();
            teamManager.Add(team);
            teamManager.Save();
            team.Players = PlayerMethod.CreatePlayers().ToList();
            foreach (Player player in team.Players)
            {
                nationManager.Add(player.Nation);
                nationManager.Save();
                playerSkillManager.Add(player.PlayerSkill);
                playerSkillManager.Save();
                playerManager.Add(player);
                playerManager.Save();
            }
            teamManager.Save();
            return(team);
        }