public IEnumerable<PlayerGameStatistics> GetByMonthAndYear(int month, int year)
{
using (var connection = BolfTrackerDbConnection.GetProfiledConnection())
{
connection.Open();
string query = "SELECT * FROM PlayerGameStatistics pgs " +
"INNER JOIN Game g on g.Id = pgs.GameId " +
"INNER JOIN Player p ON p.Id = pgs.PlayerId " +
"WHERE (DATEPART (month, g.[Date])) = @Month AND (DATEPART (year, g.[Date])) = @Year";
var playerGameStatistics = connection.Query<PlayerGameStatistics, Game, Player, PlayerGameStatistics>(query, (pgs, g, p) => { pgs.Game = g; pgs.Player = p; return pgs; }, new { Month = month, Year = year }).ToList();
return playerGameStatistics;
}
}