예제 #1
0
        public async Task StoreFeedback(IConfiguration _configuration, FeedbackEntity feedbackEntity)
        {
            var            connectionString = _configuration["storageConnectionString"];
            var            tableName        = "feedback";
            TableOperation insertOperation  = TableOperation.Insert(feedbackEntity);

            try
            {
                _storageAccount = CloudStorageAccount.Parse(connectionString);

                // Create the table client.
                _tableClient = _storageAccount.CreateCloudTableClient();

                // Get a reference to the table
                _feedbackTable = _tableClient.GetTableReference(tableName);
                await _feedbackTable.ExecuteAsync(insertOperation);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Insert to table failed with error {e.Message}");
                throw;
            }
        }