コード例 #1
0
ファイル: AdminController.cs プロジェクト: anycall/Orchard
        public ActionResult EditProperties() {
            if (!Services.Authorizer.Authorize(Permissions.ManageMedia, T("Couldn't rename media folder")))
                return new HttpUnauthorizedResult();

            var viewModel = new MediaFolderEditPropertiesViewModel();
            UpdateModel(viewModel);
            try {
                _mediaService.RenameFolder(viewModel.MediaPath, viewModel.Name);
                Services.Notifier.Information(T("Media folder properties modified"));
            }
            catch(ArgumentException argumentException) {
                Services.Notifier.Error(T("Modifying media folder properties failed: {0}", argumentException.Message));
                return View(viewModel);
            }

            return RedirectToAction("Index");
        }
コード例 #2
0
        public ActionResult EditProperties() {
            var viewModel = new MediaFolderEditPropertiesViewModel();
            try {
                UpdateModel(viewModel);
                //TODO: There may be better ways to do this.
                // Delete
                if (!String.IsNullOrEmpty(HttpContext.Request.Form["submit.Delete"])) {
                    if (!Services.Authorizer.Authorize(Permissions.ManageMediaFiles, T("Couldn't delete media folder")))
                        return new HttpUnauthorizedResult();
                    _mediaService.DeleteFolder(viewModel.MediaPath);
                }
                // Save
                else {
                    if (!Services.Authorizer.Authorize(Permissions.ManageMediaFiles, T("Couldn't rename media folder")))
                        return new HttpUnauthorizedResult();
                    _mediaService.RenameFolder(viewModel.MediaPath, viewModel.Name);
                }

                return RedirectToAction("Index");
            }
            catch (Exception exception) {
                Services.Notifier.Error("Modifying Folder Properties failed: " + exception.Message);
                return View(viewModel);
            }
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: anycall/Orchard
 public ActionResult EditProperties(string folderName, string mediaPath) {
     var model = new MediaFolderEditPropertiesViewModel { Name = folderName, MediaPath = mediaPath };
     return View(model);
 }
コード例 #4
0
        public ActionResult EditPropertiesDeletePOST()
        {
            if (!Services.Authorizer.Authorize(Permissions.ManageMedia, T("Couldn't delete media folder")))
                return new HttpUnauthorizedResult();

            var viewModel = new MediaFolderEditPropertiesViewModel();
            try {
                UpdateModel(viewModel);

                _mediaService.DeleteFolder(viewModel.MediaPath);

                Services.Notifier.Information(T("Media folder deleted"));
                return RedirectToAction("Index");
            } catch (Exception exception) {
                this.Error(exception, T("Deleting media folder failed: {0}", exception.Message), Logger, Services.Notifier);

                return View(viewModel);
            }
        }