Ejemplo n.º 1
0
        public async Task UpdateIsAnsweredAsync(Question question)
        {
            var questionEntity = new QuestionsTableEntity
            {
                CorrectAnswerId = question.CorrectAnswerId,
                PartitionKey    = question.QuestionId.ToString(),
                QuestionText    = question.QuestionText,
                RowKey          = question.CategoryId.ToString(),
                IsAnswered      = "true"
            };

            await _storageManager.UpdateIsAnswered(questionEntity);
        }
Ejemplo n.º 2
0
        public async Task  UpdateIsAnswered(QuestionsTableEntity question)
        {
            //CloudStorageAccount
            var conectionString = Configuration.GetValue<string>("StorageConfig:StringConnection");
            var storageAccount = CloudStorageAccount.Parse(conectionString);

            //CloudTableClient
            var tableClient = storageAccount.CreateCloudTableClient();

            //CloudTable
            var table = tableClient.GetTableReference("Questions");
            await table.CreateIfNotExistsAsync();

            //TableOperation
            var insertOperation = TableOperation.InsertOrMerge(question);

            await table.ExecuteAsync(insertOperation);
        }