public ActionResult Reply(Int32 id, FormCollection form) { ForumPostEntity post = ForumPostManager.GetForumPost(id); ForumTopicEntity topic = ForumTopicManager.GetForumTopic(post.TopicID); if (topic.Type == ForumTopicType.Contest) { return(RedirectToErrorMessagePage("This topic is not in the main disscus board!")); } ForumPostEntity reply = new ForumPostEntity() { Title = form["title"], Content = form["content"] }; String userip = this.GetCurrentUserIP(); String link = Url.Action("Reply", "Forum", new { id = post.PostID }); if (!ForumPostManager.InsertForumPost(reply, topic, post, userip, link)) { return(RedirectToErrorMessagePage("Failed to post your reply!")); } return(RedirectToAction("Reply", "Forum", new { id = post.PostID })); }
public ActionResult Reply(String id, FormCollection form) { ContestEntity contest = ViewData["Contest"] as ContestEntity; ForumPostEntity post = ForumPostManager.GetForumPostByTopicID(id); ForumTopicEntity topic = ForumTopicManager.GetForumTopic(post.TopicID); if (topic.Type != ForumTopicType.Contest || topic.RelativeID != contest.ContestID) { return(RedirectToErrorMessagePage("This contest does not have this topic!")); } ForumPostEntity reply = new ForumPostEntity() { Title = form["title"], Content = form["content"] }; String userip = this.GetCurrentUserIP(); String link = Url.Action("Topic", "Forum", new { area = "Contest", cid = contest.ContestID, id = post.TopicID }); if (!ForumPostManager.InsertForumPost(reply, topic, post, userip, link)) { return(RedirectToErrorMessagePage("Failed to post your reply!")); } return(RedirectToAction("Topic", "Forum", new { area = "Contest", cid = contest.ContestID, id = post.TopicID })); }