Exemplo n.º 1
0
        public ActionResult EditContentFolder(FolderEditModel folderEditModel)
        {
            ContentFolder contentFolder = folderEditModel.AsContentFolder();

            //编辑
            if (folderEditModel.ContentFolderId > 0)
            {
                contentFolderService.Update(contentFolder);
            }
            //添加
            else
            {
                contentFolderService.Create(contentFolder);
            }

            //设置栏目管理员
            IEnumerable <long> moderatorUserIds = Request.Form.Gets <long>("ModeratorUserIds");

            if (moderatorUserIds != null)
            {
                new ContentFolderModeratorService().SetModeratorBaseFolder(contentFolder.ContentFolderId, moderatorUserIds);
            }

            //编辑
            if (folderEditModel.ContentFolderId > 0)
            {
                TempData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Success, "编辑成功!");
            }
            //添加
            else
            {
                TempData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Success, "添加成功!");
            }
            return(Redirect(SiteUrls.Instance().ManageContentFolders()));
        }
Exemplo n.º 2
0
        public ActionResult EditContentFolder(int contentFolderId = 0, int parentId = 0)
        {
            FolderEditModel folderEditModel = new FolderEditModel();
            ContentFolder   contentFolder   = null;

            //编辑
            if (contentFolderId > 0)
            {
                contentFolder = contentFolderService.Get(contentFolderId);
                if (contentFolder == null)
                {
                    return(HttpNotFound());
                }
                folderEditModel = contentFolder.AsEditModel();
                ViewData["moderatorUserIds"] = contentFolder.Moderators.Select(n => n.UserId);
                pageResourceManager.InsertTitlePart("编辑栏目");
            }
            else
            {
                if (parentId > 0)
                {
                    contentFolder            = contentFolderService.Get(parentId);
                    folderEditModel.ParentId = parentId;
                    pageResourceManager.InsertTitlePart("创建子栏目");
                }
                else
                {
                    pageResourceManager.InsertTitlePart("创建栏目");
                }
            }

            return(View(folderEditModel));
        }
Exemplo n.º 3
0
        public ActionResult Create(long?parent)
        {
            var model = new FolderEditModel
            {
                ParentId = parent
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult _MoveContentFolder(int fromContentFolderId = 0, string option = "move")
        {
            FolderEditModel folderEditModel = new FolderEditModel();
            int             maxDepth        = 0;

            if (fromContentFolderId != 0)
            {
                ContentFolder contentFolder = contentFolderService.Get(fromContentFolderId);
                folderEditModel = contentFolder.AsEditModel();
                maxDepth        = contentFolder.Depth;
            }
            ViewData["option"]   = option;
            ViewData["maxDepth"] = maxDepth;
            return(View(folderEditModel));
        }
Exemplo n.º 5
0
        public ActionResult _EditContentFolderLink(FolderEditModel folderEditModel)
        {
            ContentFolder contentFolder = folderEditModel.AsContentFolder();

            contentFolder.IsLink = true;
            //编辑
            if (folderEditModel.ContentFolderId > 0)
            {
                contentFolderService.Update(contentFolder);
                return(Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!")));
            }
            //添加
            else
            {
                contentFolderService.Create(contentFolder);
                return(Json(new StatusMessageData(StatusMessageType.Success, "添加成功!")));
            }
        }
Exemplo n.º 6
0
        public ActionResult Create(FolderEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            Folder parent = null;

            if (model.ParentId.HasValue)
            {
                parent = folderRepository.Load(model.ParentId.Value);
            }
            var folder = new Folder
            {
                Name         = model.Name,
                CreationDate = DateTime.Now,
                Parent       = parent
            };

            folderRepository.Save(folder);
            return(RedirectToAction("Index", new { parent = model.ParentId }));
        }
Exemplo n.º 7
0
        public ActionResult _EditContentFolderLink(int contentFolderId = 0)
        {
            FolderEditModel folderEditModel = new FolderEditModel();

            //编辑
            if (contentFolderId > 0)
            {
                ContentFolder contentFolder = contentFolderService.Get(contentFolderId);
                if (contentFolder == null)
                {
                    return(HttpNotFound());
                }
                folderEditModel = contentFolder.AsEditModel();
                pageResourceManager.InsertTitlePart("编辑链接");
            }
            else
            {
                pageResourceManager.InsertTitlePart("创建链接");
                folderEditModel.ContentFolderId = 0;
            }

            return(View(folderEditModel));
        }
 public ActionResult _MoveContentFolder(int fromContentFolderId = 0, string option = "move")
 {
     FolderEditModel folderEditModel = new FolderEditModel();
     int maxDepth = 0;
     if (fromContentFolderId != 0)
     {
         ContentFolder contentFolder = contentFolderService.Get(fromContentFolderId);
         folderEditModel = contentFolder.AsEditModel();
         maxDepth = contentFolder.Depth;
     }
     ViewData["option"] = option;
     ViewData["maxDepth"] = maxDepth;
     return View(folderEditModel);
 }
 public ActionResult _EditContentFolderLink(FolderEditModel folderEditModel)
 {
     ContentFolder contentFolder = folderEditModel.AsContentFolder();
     contentFolder.IsLink = true;
     //编辑
     if (folderEditModel.ContentFolderId > 0)
     {
         contentFolderService.Update(contentFolder);
         return Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!"));
     }
     //添加
     else
     {
         contentFolderService.Create(contentFolder);
         return Json(new StatusMessageData(StatusMessageType.Success, "添加成功!"));
     }
 }
        public ActionResult _EditContentFolderLink(int contentFolderId = 0)
        {
            FolderEditModel folderEditModel = new FolderEditModel();
            //编辑
            if (contentFolderId > 0)
            {
                ContentFolder contentFolder = contentFolderService.Get(contentFolderId);
                if (contentFolder == null)
                    return HttpNotFound();
                folderEditModel = contentFolder.AsEditModel();
                pageResourceManager.InsertTitlePart("编辑链接");
            }
            else
            {
                pageResourceManager.InsertTitlePart("创建链接");
                folderEditModel.ContentFolderId = 0;
            }

            return View(folderEditModel);
        }
        public ActionResult EditContentFolder(FolderEditModel folderEditModel)
        {
            ContentFolder contentFolder = folderEditModel.AsContentFolder();
            //编辑
            if (folderEditModel.ContentFolderId > 0)
            {
                contentFolderService.Update(contentFolder);
            }
            //添加
            else
            {
                contentFolderService.Create(contentFolder);
            }

            //设置栏目管理员
            IEnumerable<long> moderatorUserIds = Request.Form.Gets<long>("ModeratorUserIds");
            if (moderatorUserIds != null)
                new ContentFolderModeratorService().SetModeratorBaseFolder(contentFolder.ContentFolderId, moderatorUserIds);

            //编辑
            if (folderEditModel.ContentFolderId > 0)
            {
                TempData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Success, "编辑成功!");
            }
            //添加
            else
            {
                TempData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Success, "添加成功!");
            }
            return Redirect(SiteUrls.Instance().ManageContentFolders());
        }
        public ActionResult EditContentFolder(int contentFolderId = 0, int parentId = 0)
        {
            FolderEditModel folderEditModel = new FolderEditModel();
            ContentFolder contentFolder = null;
            //编辑
            if (contentFolderId > 0)
            {
                contentFolder = contentFolderService.Get(contentFolderId);
                if (contentFolder == null)
                    return HttpNotFound();
                folderEditModel = contentFolder.AsEditModel();
                ViewData["moderatorUserIds"] = contentFolder.Moderators.Select(n => n.UserId);
                pageResourceManager.InsertTitlePart("编辑栏目");
            }
            else
            {
                if (parentId > 0)
                {
                    contentFolder = contentFolderService.Get(parentId);
                    folderEditModel.ParentId = parentId;
                    pageResourceManager.InsertTitlePart("创建子栏目");
                }
                else
                    pageResourceManager.InsertTitlePart("创建栏目");
            }

            return View(folderEditModel);
        }