Пример #1
0
        public async Task <Game> CreateGame(Game game)
        {
            const string query = @"INSERT INTO dbo.Game(Name) VALUES(@Name);
                                    SELECT Name FROM dbo.Game WHERE Id = SCOPE_IDENTITY();";

            GameRow row    = GameRow.FromDomain(game);
            string  result = "";

            using (var conn = new SqlConnection(_connectionStr))
            {
                result = (await conn.QueryAsync <string>(query, row)).First();
            }
            return(await LoadGame(result));
        }