in saga-orchestration/UpdateInventoryLambda/src/UpdateInventoryLambda/Function.cs [69:90]
private void UpdateStock(string ItemId, ILambdaContext context)
{
var updateRequest = new UpdateItemRequest()
{
TableName = tableName,
Key = new Dictionary<string, AttributeValue>
{
{ "ItemId", new AttributeValue { S =ItemId } }
},
ExpressionAttributeValues = new Dictionary<string, AttributeValue>
{
{ ":inc", new AttributeValue { N = "1" } }
},
UpdateExpression = "SET ItemsInStock = ItemsInStock - :inc",
ReturnValues = "ALL_NEW"
};
var response = client.UpdateItemAsync(updateRequest);
var attributeList = response.Result.Attributes; // attribute list in the response.
// print attributeList.
Console.WriteLine("\nPrinting item after decrementing stock ............");
PrintItem(attributeList,context);
}