public async Task Update()

in Storage/DynamoDb/SampleApplication/Controllers/Document/ProductsController.cs [87:113]


        public async Task<IActionResult> Update([FromBody] Amazon.DynamoDBv2.DocumentModel.Document product, string productId, string publishedOn)
        {
            var table = await _dbTableBuilder.Build();
            try
            {
                var checkForProduct = await table.GetItemAsync(productId, publishedOn);
                if (checkForProduct == null) return NotFound();
                product["DocumentProductId"] = productId;
                product["PublishOn"] = publishedOn;
                await table.UpdateItemAsync(product);
                var updatedProduct = await table.GetItemAsync(productId, publishedOn);
                return Ok(updatedProduct.ToJson());
            }
            catch (AmazonDynamoDBException addbe)
            {
                return AmazonExceptionHandlers.HandleAmazonDynamoDBException(addbe);
            }
            catch (AmazonServiceException ase)
            {
                AmazonExceptionHandlers.HandleAmazonServiceExceptionException(ase);
            }
            catch (AmazonClientException ace)
            {
                AmazonExceptionHandlers.HandleAmazonClientExceptionException(ace);
            }
            return StatusCode(500);
        }