Esempio 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();
        }
Esempio 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"
                }));
            }
        }