Skip to content

Commit 7c6b2b3

Browse files
author
George Wallace
committed
updates to solution to remove queue
1 parent d119ecb commit 7c6b2b3

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

ImageResizeWebApp/ImageResizeWebApp/Controllers/ImagesController.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using Microsoft.Azure;
1111
using Microsoft.WindowsAzure.Storage;
1212
using Microsoft.WindowsAzure.Storage.Blob;
13-
using Microsoft.WindowsAzure.Storage.Queue;
1413
using Microsoft.WindowsAzure.Storage.Auth;
1514
using System.Net.Http;
1615
using Microsoft.AspNetCore.Http;
@@ -52,10 +51,6 @@ public async Task<IActionResult> Upload(ICollection<IFormFile> files)
5251

5352
return BadRequest("Please provide a name for your image container in the azure blob storage");
5453

55-
if (storageConfig.QueueName == string.Empty)
56-
57-
return BadRequest("Please provide a name for storage queue");
58-
5954
foreach (var formFile in files)
6055
{
6156
if (StorageHelper.IsImage(formFile))
@@ -69,7 +64,7 @@ public async Task<IActionResult> Upload(ICollection<IFormFile> files)
6964

7065
if (isUploaded)
7166
{
72-
isQueued = await StorageHelper.CreateQueueItem(formFile.FileName, storageConfig);
67+
// TODO
7368
}
7469
else
7570
{

ImageResizeWebApp/ImageResizeWebApp/Helpers/StorageHelper.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,6 @@ public static async Task<bool> UploadFileToStorage(Stream fileStream, string fil
5353
return await Task.FromResult(true);
5454
}
5555

56-
public static async Task<bool> CreateQueueItem(string imageInfo, AzureStorageConfig _storageConfig)
57-
{
58-
// Create storagecredentials object by reading the values from the configuration (appsettings.json)
59-
StorageCredentials storageCredentials = new StorageCredentials(_storageConfig.AccountName, _storageConfig.AccountKey);
60-
61-
// Create cloudstorage account by passing the storagecredentials
62-
CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, true);
63-
64-
// Create the queue client.
65-
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
66-
67-
// Retrieve a reference to a queue.
68-
CloudQueue queue = queueClient.GetQueueReference(_storageConfig.QueueName);
69-
70-
// Create the queue if it doesn't already exist.
71-
await queue.CreateIfNotExistsAsync();
72-
73-
// Create a message and add it to the queue.
74-
CloudQueueMessage message = new CloudQueueMessage(imageInfo);
75-
76-
// Add a message to the queue
77-
await queue.AddMessageAsync(message);
78-
79-
return await Task.FromResult(true);
80-
}
81-
8256
public static async Task<List<string>> GetThumbNailUrls(AzureStorageConfig _storageConfig)
8357
{
8458
List<string> thumbnailUrls = new List<string>();

0 commit comments

Comments
 (0)