public ActionResult Edit(Guid key) { var topic = _topicDriver.Get(key, new string[] { "Tags", "Tags.Category", "Thread", "Thread.TagCategoryMaps" }); if (topic != null && !topic.IsNew()) { TopicClient topicClient = _topicDriver.ToClient(topic); ProcessTagOption(topicClient); ScriptRegister.AddJson("topic", topicClient); return(View("Record", topicClient)); } return(HttpNotFound()); }
public ActionResult Show(Guid key) { var commentsPerTopic = _topicDriver.GetTopicWithComments(key, PageConstants.FirstPageNumber, DefaultSetting.CommentsPerPage); if (commentsPerTopic == null) { return(HttpNotFound()); } ScriptRegister.AddJson("commentsPerTopic", _topicDriver.ToTopicWithCommentsClient(commentsPerTopic)); var newComment = _commentDriver.Create(); newComment.TopicId = commentsPerTopic.Topic.Id; newComment.Topic = commentsPerTopic.Topic; ScriptRegister.AddJson("newComment", _commentDriver.ToClient(newComment)); ViewBag.CurrentThread = _threadDriver.Get(commentsPerTopic.Topic.ThreadId); return(View()); }
public ActionResult New(string key) { var currentThread = string.IsNullOrEmpty(key) ? _threadDriver.RootThread : _threadDriver.GetThreadByKey(key); if (currentThread == null) { return(HttpNotFound()); } var topic = _topicDriver.Create(); topic.Thread = currentThread; topic.ThreadId = currentThread.Id; var topicClient = _topicDriver.ToClient(topic); ProcessTagOption(topicClient); ScriptRegister.AddJson("topic", topicClient); return(View("Record", topicClient)); }