Exemplo n.º 1
0
        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"));
            }
        }
Exemplo n.º 2
0
        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"));
            }
        }
Exemplo n.º 3
0
        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"));
            }
        }
Exemplo n.º 4
0
        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"));
            }
        }