Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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"
                }));
            }
        }