public async void DeleteUserData() { using (var myMongoDBManager = new MyMongoDBManager(Variables.MongoDBConnectionStringRW, Variables.MongoDBDatbaseName)) using (var myBlobStorageManager = new MyBlobStorageManager(Variables.BlobStorageConnectionString, _userId)) { var response = await myBlobStorageManager.DeleteUserContainerAsync(); if (response.IsSuccess) { var photos = await myMongoDBManager.GetPhotoForGalleryAsync(_userId); foreach (var photo in photos) { myMongoDBManager.RemovePhotoAsync(photo._id); } } } }
public IActionResult Gallery(string tag = "", bool multipleDeletes = false) { var photos = _myMongoDbManager.GetPhotoForGalleryAsync(_userId, tag); GalleryModel galleryModel = null; using (MyBlobStorageManager myBlobStorageManager = new MyBlobStorageManager(Variables.BlobStorageConnectionString, _userId)) { string sasUri = myBlobStorageManager.GetContainerSasUri(); photos.Result.ForEach(x => x.PhotoPhatPreview += sasUri); galleryModel = new GalleryModel() { Photos = photos.Result, LastTag = tag, MultipleDeletes = multipleDeletes }; } return(View(galleryModel)); }