public IHttpActionResult Get(int id)
        {
            var result = _forumTopicService.GetById(id: id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(content: result));
        }
Beispiel #2
0
        // 创建回帖
        public void CreatePost(ForumPost post)
        {
            ForumTopic topic = topicService.GetById(post.TopicId, owner);

            List <String> urls = new List <String>();

            urls.Add(controller.to(new ForumController().Index));     // 论坛首页失效

            ForumBoard bd = boardService.GetById(topic.ForumBoard.Id, owner);

            addBoardUrl(urls, bd, 0);   // 所在版块失效(帖子被顶到前面)

            removeCacheList(urls);

            //-------------------------------------------------
            // 修改 forum 和 topic 的 timestamp,让论坛最新主题、所有主题的回帖列表失效
            String forumKey = "forum_" + controller.ctx.app.Id;

            cacheHelper.SetTimestamp(forumKey, DateTime.Now);

            String topicKey = "forumtopic_" + topic.Id;

            cacheHelper.SetTimestamp(topicKey, DateTime.Now);
        }