Exemplo n.º 1
0
        public void CreateGame()
        {
            var gameEntity = repo.Insert(new GameEntity(10));

            Console.WriteLine(gameEntity.Id);
            gameEntity.Id.Should().NotBe(Guid.Empty);
        }
Exemplo n.º 2
0
        public IActionResult Create([FromBody] CreateGameDTO gameDto)
        {
            if (!HttpContext.User.Identity.IsAuthenticated)
            {
                return(Unauthorized());
            }
            var game = new GameEntity(gameDto.IsOpen, gameDto.RoundsCount, gameDto.RoundTime, HttpContext.User.Identity.Name);

            _gameRepository.Insert(game);
            return(Created(game.GameId.ToString(), game));
        }