public ActionResult <Result <GameProfile> > Create([FromBody] CreateGameRequest request)
        {
            var game        = _gameStore.Save(request);
            var gameProfile = _gameProfileFactory.Create(game);

            return(Result <GameProfile> .Successful(gameProfile));
        }
Ejemplo n.º 2
0
        public IGame Save(CreateGameRequest createGameRequest)
        {
            using (var connection = AppDataConnection.Create())
            {
                const string sql = @"
					INSERT INTO public.game
					(name, release_date)
					VALUES
					(@Name, @ReleaseDate)
					RETURNING game_id;"                    ;

                var gameId = connection.Query <Id <Game> >(sql, createGameRequest).Single();
                return(FindGamesByGameId(new[] { gameId })[gameId]);
            }
        }