public async Task EndMatch(GameServerIdentityContainer apiUserIdentity, MatchEndBody matchEnd) { await this.dbContext.ValidateGameServerIdentity(apiUserIdentity); var match = await this.dbContext.ValidateMatchNotEnded(matchEnd.MatchId); match.HasEnded = true; match.SecondsPlayed = matchEnd.SecondsPlayed; await this.dbContext.SaveChangesAsync(); }
public async Task <IActionResult> EndMatch([FromBody] MatchEndBody matchEnd) { try { await service.EndMatch(GetApiUserIdentityContainer(), matchEnd); return(Ok()); } catch (Exception) { return(Error(new ErrorResult { Classification = ErrorClassification.InternalError, Message = "Failed to end match" })); } }