コード例 #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);
        }
コード例 #2
0
 //[ApiAuthorizeAttribute(Roles = "A")]
 public EntityHttpResponse Delete(int id)
 {
     _nationManager.Delete(x => x.id == id);
     _nationManager.Save();
     return(new EntityHttpResponse(System.Net.HttpStatusCode.NoContent, null, true));
 }