Exemplo n.º 1
0
        private async Task RemoveOpinion(OpinionEntity deleteEntity)
        {
            if (deleteEntity != null)
            {
                TableOperation deleteOperation = TableOperation.Delete(deleteEntity);

                // Execute the operation.
                await _table.ExecuteAsync(deleteOperation);
            }
        }
Exemplo n.º 2
0
        private async Task InsertEntity(string userId, DateTime now, Dictionary <long, int> opinions)
        {
            var entity = new OpinionEntity(_partitionKey, userId);

            entity.OpinionsJson = (opinions == null) ? String.Empty : JsonConvert.SerializeObject(opinions);
            entity.Inserted     = now;
            entity.Updated      = now;

            var insertOperation = TableOperation.Insert(entity);

            await _table.ExecuteAsync(insertOperation);
        }
Exemplo n.º 3
0
        private async Task UpdateOpinion(OpinionEntity updateEntity, string opinionsJson)
        {
            // Change the phone number.
            updateEntity.Updated      = DateTime.UtcNow;
            updateEntity.OpinionsJson = opinionsJson;

            // Create the Replace TableOperation.
            var updateOperation = TableOperation.Replace(updateEntity);

            // Execute the operation.
            await _table.ExecuteAsync(updateOperation);
        }