public decimal GetPlayerSalary(long playerId) { SoccerPlayer player = null; if (!listSoccerPlayer.TryGetValue(playerId, out player)) { throw new PlayerNotFoundException(); } return(player.salary); }
public string GetPlayerName(long playerId) { SoccerPlayer player = null; listSoccerPlayer.TryGetValue(playerId, out player); if (player == null) { throw new PlayerNotFoundException(); } return(player.name); }
public void SetCaptain(long playerId) { SoccerPlayer soccerPlayer = null; listSoccerPlayer.TryGetValue(playerId, out soccerPlayer); if (soccerPlayer == null) { throw new PlayerNotFoundException(); } SoccerTeam soccerTeam = null; listSoccerTeam.TryGetValue(soccerPlayer.teamId, out soccerTeam); soccerTeam.captainPlayerId = playerId; }
public void AddPlayer(long id, long teamId, string name, DateTime birthDate, int skillLevel, decimal salary) { foreach (var teamItem in _soccerTeams.Values) { if (teamItem.ContainsPlayerId(id)) { throw new UniqueIdentifierException($"Já existe um jogador com o ID '{id}'."); } } SoccerTeam team; if (!_soccerTeams.TryGetValue(teamId, out team)) { throw new TeamNotFoundException($"Não foi encontrado o time: {teamId}"); } else { var newPlayer = new SoccerPlayer(id, teamId, name, birthDate, skillLevel, salary); team.AddPlayer(newPlayer); } }
public string GetPlayerName(long playerId) { SoccerPlayer player = GetPlayer(playerId); return(player.Name); }
public void SetCaptain(long playerId) { SoccerPlayer newCaptain = GetPlayer(playerId); _soccerTeams[newCaptain.TeamId].SetCaptain(playerId); }
public decimal GetPlayerSalary(long playerId) { SoccerPlayer player = GetPlayer(playerId); return(player.Salary); }