public async Task <IActionResult> DeleteDataPackage(string packageName) { try { await BlobStorageService.DeleteBlockBlob(BlobStorageService.DataContainerName, packageName); var dataPackage = Program.AvailablePackages.FirstOrDefault(x => x.PackageName == packageName); if (dataPackage != null) { if (Program.CurrentData == dataPackage) { Program.CurrentData = null; } Program.AvailablePackages.Remove(dataPackage); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <ActionResult> DeleteImage(string name) { try { await BlobStorageService.DeleteBlockBlob(BlobStorageService.PicturesContainerName, name); return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <ActionResult> DeleteAllImages() { try { var list = await BlobStorageService.GetBlobList(BlobStorageService.PicturesContainerName); foreach (var image in list) { await BlobStorageService.DeleteBlockBlob(BlobStorageService.PicturesContainerName, image); } return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <ActionResult> DeleteAllDataPackages() { try { var list = await BlobStorageService.GetBlobList(BlobStorageService.DataContainerName); foreach (var data in list) { await BlobStorageService.DeleteBlockBlob(BlobStorageService.DataContainerName, data); } Program.CurrentData = null; Program.AvailablePackages.Clear(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }