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"); }
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); } }
public ActionResult EditProperties(string folderName, string mediaPath) { var model = new MediaFolderEditPropertiesViewModel { Name = folderName, MediaPath = mediaPath }; return View(model); }
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); } }