public async Task <IActionResult> Get(string productId, string publishedOn)
        {
            var db = await _dbContextBuilder.Build();

            try
            {
                var product = await db.LoadAsync <Product>(hashKey : productId, rangeKey : publishedOn);

                if (product == null)
                {
                    return(NotFound());
                }
                Console.WriteLine(product.ObjectPersistenceProductId);
                Console.WriteLine(product.PublishOn);
                return(Ok(product));
            }
            catch (AmazonDynamoDBException addbe)
            {
                return(AmazonExceptionHandlers.HandleAmazonDynamoDBException(addbe));
            }
            catch (AmazonServiceException ase)
            {
                AmazonExceptionHandlers.HandleAmazonServiceExceptionException(ase);
            }
            catch (AmazonClientException ace)
            {
                AmazonExceptionHandlers.HandleAmazonClientExceptionException(ace);
            }
            return(StatusCode(500));
        }
Example #2
0
        public async Task <IActionResult> GetTables()
        {
            var req = new ListTablesRequest();

            req.Limit = 100;
            await _opmDynamoContextBuilder.Build();

            var res = await _dynamoClient.ListTablesAsync(req);

            foreach (var item in res.TableNames)
            {
                Console.WriteLine("Table Name: {0}", item);
            }
            return(Ok(res.TableNames));
        }