Пример #1
0
 public ActionResult Create() {
     var viewModel = new MediaFolderCreateViewModel();
     try {
         UpdateModel(viewModel);
         if (!Services.Authorizer.Authorize(Permissions.ManageMediaFiles, T("Couldn't create media folder")))
             return new HttpUnauthorizedResult();
         _mediaService.CreateFolder(viewModel.MediaPath, viewModel.Name);
         return RedirectToAction("Index");
     }
     catch (Exception exception) {
         Services.Notifier.Error("Creating Folder failed: " + exception.Message);
         return View(viewModel);
     }
 }
Пример #2
0
        public ActionResult Create() {
            if (!Services.Authorizer.Authorize(Permissions.ManageMedia, T("Couldn't create media folder")))
                return new HttpUnauthorizedResult();

            var viewModel = new MediaFolderCreateViewModel();
            UpdateModel(viewModel);

            try {
                _mediaService.CreateFolder(viewModel.MediaPath, viewModel.Name);
                Services.Notifier.Information(T("Media folder created"));
            }
            catch(ArgumentException argumentException) {
                Services.Notifier.Error(T("Creating Folder failed: {0}", argumentException.Message));
                return View(viewModel);
            }

            return RedirectToAction("Edit", new { viewModel.Name, viewModel.MediaPath });
        }
        public ActionResult Create() {
            if (!Services.Authorizer.Authorize(Permissions.ManageMedia, T("Couldn't create media folder")))
                return new HttpUnauthorizedResult();

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

                _mediaService.CreateFolder(viewModel.MediaPath, viewModel.Name);

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

                return View(viewModel);
            }
        }