コード例 #1
0
        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 });
        }
コード例 #2
0
        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 });
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 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);
     }
 }