public ActionResult CreateForum() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageForums)) return AccessDeniedView(); var model = new ForumModel(); foreach (var forumGroup in _forumService.GetAllForumGroups()) { var forumGroupModel = forumGroup.ToModel(); model.ForumGroups.Add(forumGroupModel); } model.DisplayOrder = 1; return View(model); }
public ActionResult CreateForum(ForumModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageForums)) return AccessDeniedView(); if (ModelState.IsValid) { var forum = model.ToEntity(); forum.CreatedOnUtc = DateTime.UtcNow; forum.UpdatedOnUtc = DateTime.UtcNow; _forumService.InsertForum(forum); SuccessNotification(_localizationService.GetResource("Admin.ContentManagement.Forums.Forum.Added")); return continueEditing ? RedirectToAction("EditForum", new { forum.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form foreach (var forumGroup in _forumService.GetAllForumGroups()) { var forumGroupModel = forumGroup.ToModel(); model.ForumGroups.Add(forumGroupModel); } return View(model); }