Created
October 7, 2020 09:25
-
-
Save zainafzal88/4119548e55865c56524c152f3962cfee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public async Task Post([FromBody] Comments comment) | |
{ | |
Guid uuid = Guid.NewGuid(); | |
var item = new Dictionary<string, AttributeValue>() | |
{ | |
{"id", new AttributeValue{S = uuid.ToString()}}, | |
{"username", new AttributeValue{S = comment.Username}}, | |
{"comment", new AttributeValue{S = comment.Comment}}, | |
{"postId", new AttributeValue{S = comment.PostId}}, | |
{"date", new AttributeValue{S = DateTime.Now.ToString()}} | |
}; | |
PutItemRequest request = new PutItemRequest | |
{ | |
TableName = TableName, | |
Item = item | |
}; | |
await _amazonDynamoDb.PutItemAsync(request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment