Example #1
0
        public async Task <IActionResult> CreateGame([FromBody] GameCreateDto dto)
        {
            var entity = this.mapper.Map <Game>(dto);

            entity.AdminId = this.User.Identity.Name;
            entity.TryAddPlayer(new PlayerGame {
                PlayerId = this.User.Identity.Name, GameId = entity.Id
            });

            await this.gameService.CreateAsync(entity);

            return(this.Ok());
        }