Beispiel #1
0
        public IActionResult CreateSession(GameSessionViewModel gameSessionViewModel)
        {
            if (ModelState.IsValid)
            {
                var creator = new Player()
                {
                    Id   = Guid.NewGuid(),
                    Name = gameSessionViewModel.CreatorName
                };

                var gameSession = _gameSessionService.Add(gameSessionViewModel.Name, GameSessionStates.New, creator);

                return(Ok(gameSession));
            }
            else
            {
                return(BadRequest());
            }
        }