Example #1
0
        public Guid Create(string player1Id, string player2Id, string userId)
        {
            try
            {
                _authorizer.AssertAuthorizedForCreate(userId);

                var game = _factory.Create(player1Id, player2Id);

                var id = _repo.Add(game);

                _logger.Info($"Created a game between '{player1Id}' and '{player2Id}'.");

                return(id);
            }
            catch (Exception ex)
            {
                _logger.Error("An error occurred creating a game", ex);
                throw;
            }
        }