/// <summary> /// Converts the get player scores response. /// </summary> /// <param name="managerResponse">The manager response.</param> /// <returns></returns> private GetPlayerScoresResponsev2 ConvertGetPlayerScoresResponse(GetPlayerScoresResponsev1 managerResponse) { GetPlayerScoresResponsev2 response = new GetPlayerScoresResponsev2(); response.Scores = new List <PlayerScoreResponse>(); foreach (DataTransferObjects.Responses.PlayerScoreResponse managerResponseScore in managerResponse.Scores) { response.Scores.Add(new PlayerScoreResponse { GolfClubId = managerResponseScore.GolfClubId, MeasuredCourseId = managerResponseScore.MeasuredCourseId, TournamentFormat = (TournamentFormat)managerResponseScore.TournamentFormat, TournamentDate = managerResponseScore.TournamentDate, TournamentName = managerResponseScore.TournamentName, MeasuredCourseName = managerResponseScore.MeasuredCourseName, TournamentId = managerResponseScore.TournamentId, PlayerId = managerResponseScore.PlayerId, MeasuredCourseTeeColour = managerResponseScore.MeasuredCourseTeeColour, GolfClubName = managerResponseScore.GolfClubName, PlayingHandicap = managerResponseScore.PlayingHandicap, CSS = managerResponseScore.CSS, NetScore = managerResponseScore.NetScore, GrossScore = managerResponseScore.GrossScore }); } return(response); }
public async Task <IActionResult> GetPlayerScores(Guid playerId, [FromQuery] Int32 numberOfScores, CancellationToken cancellationToken) { GetPlayerScoresResponsev1 managerResponse = await this.ReportingManager.GetPlayerScoresReport(playerId, numberOfScores, cancellationToken); GetPlayerScoresResponsev2 response = this.ConvertGetPlayerScoresResponse(managerResponse); return(this.Ok(response)); }