Beispiel #1
0
        // Add coach from a team
        /// <summary>
        /// Add coach from a team.
        /// </summary>
        /// <returns>
        /// Nothing
        /// </returns>
        public void AddCoachToATeam(int teamId, int coachId)
        {
            Team  team  = GetTeamById(teamId);
            Coach coach = coachService.GetCoachById(coachId);

            if (team.Coaches.Contains(coach))
            {
                throw new ArgumentException(ExceptionMessages.InvalidId);
            }

            team.AddCoach(coach);

            context.SaveChanges();
        }