public JsonResult GetPlayerMatchSummaryData(long gameid, string code, long playerid) { try { /* * the gameId and code passed must correlate or they may be something malicious going on. so we stop * the response ASAP and throw an exception */ ProbeValidate.ValidateGameCodeVersusId(gameid, code); var result = db.Database.SqlQuery <PlayerMatchSummaryData> ("exec GetPlayerMatchSummary " + gameid + "," + playerid).ToList(); List <PlayerMatchSummaryReturn> reportData = new List <PlayerMatchSummaryReturn>(); foreach (PlayerMatchSummaryData row in result) { PlayerMatchSummaryReturn pmsr = new PlayerMatchSummaryReturn { Id = row.MatchedPlayerId, Name = row.MatchedPlayerName, Value = row.NbrOfMatched }; reportData.Add(pmsr); } return(Json(reportData)); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); //log to elmah ModelState.AddModelError("", ProbeConstants.MSG_UnsuccessfulOperation_STR); return(Json(ModelState)); } }//public JsonResult GetPlayerMatchSummaryData(long gameid, string code, long playerid)
public List <PlayerMatchSummaryReturn> GetPlayerMatchSummaryData(long gameid, string code, long playerid) { /* * the gameid and code passed must correlate or they may be something malicious going on. so we stop * the response ASAP and throw an exception AND WE DO NOT CATCH IT, which should be picked up by Elmah. Exception handling here * have to be improved big-time */ ProbeValidate.ValidateGameCodeVersusId(gameid, code); var result = db.Database.SqlQuery <PlayerMatchSummaryData> ("exec GetPlayerMatchSummary " + gameid + "," + playerid).ToList(); List <PlayerMatchSummaryReturn> reportData = new List <PlayerMatchSummaryReturn>(); foreach (PlayerMatchSummaryData row in result) { PlayerMatchSummaryReturn pmsr = new PlayerMatchSummaryReturn { Id = row.MatchedPlayerId, Name = row.MatchedPlayerName, Value = row.NbrOfMatched }; reportData.Add(pmsr); } return(reportData); }