Beispiel #1
0
        public async Task UpdateRecord(ImageEntity imageEntity)
        {
            // initialize
            await Initialzie();

            var result = await CloudTable.ExecuteAsync(TableOperation.Merge(imageEntity));
        }
Beispiel #2
0
        /// <summary>
        /// Adds the image entity to the queue
        /// </summary>
        /// <param name="record">entity to add</param>
        private async Task AddToQueue(ImageEntity record)
        {
            // TODO: should probably be optimized
            var qc    = StorageAccount.CreateCloudQueueClient();
            var queue = qc.GetQueueReference("imageprocessingqueue");
            await queue.CreateIfNotExistsAsync();

            await queue.AddMessageAsync(new Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage(JsonConvert.SerializeObject(record)));
        }
Beispiel #3
0
        public async Task <string> AddOriginalImage(string url)
        {
            // initialize
            await Initialzie();

            // compose the record and add it
            var record = new ImageEntity {
                OriginalImageUrl = url
            };
            var result = await CloudTable.ExecuteAsync(TableOperation.Insert(record));

            // add to queue for processing of image
            await AddToQueue(record);

            // return the row key
            return(record.RowKey);
        }