New item is not creating in DynamoDB table ,even though C# code is not throwing error

Viewed 19

I am using free tier of AWZ. Trying to insert item in DynamoDb Table. Below code doesn't throw any exception but also not creating new item in table.

Please let me know what i am doing wrong here. Note: Using AWZ free tier.

public async Task Additem()
        {
            try
            {
                AmazonDynamoDBClient client = new AmazonDynamoDBClient();
                string tableName = "Car";
                var request = new PutItemRequest
                {
                    TableName = tableName,
                    Item = new Dictionary<string, AttributeValue>()
                    {
                          { "Id", new AttributeValue { N = "201" }},
                          { "Name", new AttributeValue { S = "Car2" }},
                          { "Price", new AttributeValue { N = "200" }}

                    }
                };
                var result = await client.PutItemAsync(request);
            }
            catch ( Exception ex)
            {
                throw ex;
            }

        }
0 Answers
Related