public ActionResult Delete() { if (!Services.Authorizer.Authorize(Permissions.ManageOwnMedia)) { Services.Notifier.Error(T("Couldn't delete media folder")); return(new HttpUnauthorizedResult()); } var viewModel = new MediaManagerFolderEditViewModel(); UpdateModel(viewModel); if (!_mediaLibraryService.CheckMediaFolderPermission(Permissions.DeleteMediaContent, viewModel.FolderPath)) { return(new HttpUnauthorizedResult()); } try { _mediaLibraryService.DeleteFolder(viewModel.FolderPath); Services.Notifier.Success(T("Media folder deleted")); } catch (ArgumentException argumentException) { Services.Notifier.Error(T("Deleting Folder failed: {0}", argumentException.Message)); Services.TransactionManager.Cancel(); return(View(viewModel)); } return(RedirectToAction("Index", "Admin", new { area = "Orchard.MediaLibrary" })); }
public void DeleteImageGallery(string name) { var gallerySettings = GetImageGallerySettings(GetMediaPath(name)); foreach (ImageGalleryImage image in GetImageGallery(name).Images) { DeleteImage(name, image.Name, GetImageSettings(gallerySettings, image.Name)); } if (gallerySettings != null) { _repository.Delete(gallerySettings); } _mediaService.DeleteFolder(GetMediaPath(name)); }
public async Task <ActionResult> DeleteFolder([FromQuery] string folderId) { await _mediaLibraryService.DeleteFolder(folderId); return(Ok()); }