public IList<PlayerVersusPlayerStatistics> GetPlayerVersusPlayersStatistics(int playerId)
{
var data = dataContext.MakeRawSqlQuery<WinLossStatistics>(SQL_GET_WIN_LOSS_GAMES_COUNT,
new SqlParameter("PlayerId", playerId));
var winLossStatistics = data
.OrderByDescending(x => x.VersusPlayerActive)
.ThenByDescending(x => x.NumberOfGamesLost + x.NumberOfGamesWon).ToList();
return winLossStatistics.Select(winLossStats => new PlayerVersusPlayerStatistics
{
NumberOfGamesLostVersusThisPlayer = winLossStats.NumberOfGamesLost,
NumberOfGamesWonVersusThisPlayer = winLossStats.NumberOfGamesWon,
OpposingPlayerId = winLossStats.VersusPlayerId,
OpposingPlayerName = winLossStats.VersusPlayerName,
OpposingPlayerActive = winLossStats.VersusPlayerActive
}).ToList();
}