public IActionResult SetMatchResult([FromRoute] Guid tournamentId, [FromBody] SetMatchResultModel model) { var traceId = Guid.NewGuid(); var tournament = _clusterClient.GetGrain <ITournamentGrain>(tournamentId); var matchInfo = new Match(model.LocalTeamId, model.AwayTeamId, new MatchResult(model.LocalGoals, model.AwayGoals, true)); tournament.SetMatchResultAsync(new SetMatchResult(tournamentId, matchInfo, traceId, GetUserId)); return(Ok(new TraceResponse(traceId))); }
public bool SetMatchResult(SetMatchResultModel model) { var isFirstPlayerWinner = model.FirstPlayerScore > model.SecondPlayerScore; var command = $@" UPDATE LeagueMatch SET FirstPlayerScore = @FirstPlayerScore, SecondPlayerScore = @SecondPlayerScore, MatchDate = @MatchDate, WinnerPlayerId = {(isFirstPlayerWinner ? "FirstPlayerId" : "SecondPlayerId")} WHERE Id = @LeagueMatchId"; return(ExecCommand(command, model)); }
public bool SetMatchResult(long id, SetMatchResultModel model) { model.LeagueMatchId = id; return(_leagueLib.SetMatchResult(model)); }