Example #1
0
        public async Task <bool> RemovePlayerFromGameAsync(string gameId, string playerId)
        {
            //Get game
            var game = await _GameDataAccess.GetGameAsync(gameId).ConfigureAwait(false);

            if (game == null)
            {
                // Game doesnt exist
                return(false);
            }

            if (game.State != GameStatusEnum.WaitingForPlayers)
            {
                // Game already started or finished
                return(false);
            }

            return(await _GameDataAccess.RemovePlayerFromGameAsync(gameId, playerId).ConfigureAwait(false));
        }