Beispiel #1
0
    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)));
    }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 public bool SetMatchResult(long id, SetMatchResultModel model)
 {
     model.LeagueMatchId = id;
     return(_leagueLib.SetMatchResult(model));
 }