public ActionResult CreateThread(NewPostModel model) { Thread thread = model.Thread; thread.OpeningPost = model.Post; thread.OpeningPost.user = model.CurrentUser; thread.Save(); return RedirectToAction("ViewThread", new { id = thread.thread_id }); }
public ActionResult CreateReply(NewPostModel model) { Thread thread = model.Thread; Post post = model.Post; post.user = model.CurrentUser; thread.AddPost(post); return RedirectToAction("ViewThread", new { id = thread.thread_id }); }
public ActionResult NewReply(int thread_id) { if (SessionContext.CurrentUser == null) { return RedirectToAction("Index"); } else { NewPostModel model = new NewPostModel(); model.PostBackAction = "CreateReply"; model.Post = new Post(); model.Thread = Thread.GetThreadByThreadId(thread_id); model.Forum = Forum.GetForumByForumId(model.Thread.forum_id); model.Post.reply_to = model.Thread.OpeningPost.post_id; model.BreadCrumb.HeaderText = "New Post"; model.BreadCrumb.Thread = model.Thread; model.BreadCrumb.Forum = model.Forum; return View("NewPost", model); } }
public ActionResult NewThread(int forum_id) { if (SessionContext.CurrentUser == null) { return RedirectToAction("Index"); } else { NewPostModel model = new NewPostModel(); model.PostBackAction = "CreateThread"; model.Thread = new Thread { forum_id = forum_id }; model.Forum = Forum.GetForumByForumId(forum_id); model.BreadCrumb.HeaderText = "New Thread"; model.BreadCrumb.Thread = model.Thread; model.BreadCrumb.Forum = model.Forum; return View("NewPost", model); } }