示例#1
0
        public List <DisplayTopic> HotTopics(int count = 5, [FromUri] string[] group = null)
        {
            string me = whoami();

            string[] joinedGroup = MembershipHelper.CheckJoinedGroup(me, group);
            var      topiclist   = _topicManager.GetHotTopics(joinedGroup, count);

            return(_topicManager.ToDisplayTopicList(topiclist, me));
        }
示例#2
0
        public bool IsFavouriteTopic(string topic, [FromUri] string[] group)
        {
            group = MembershipHelper.CheckJoinedGroup(whoami(), group);
            var t = _topicManager.FindTopicByName(topic, group);

            if (t == null)
            {
                return(false);
            }

            return(_topicManager.IsFavouriteTopic(whoami(), t.Id));
        }
示例#3
0
        public List <DisplayTopic> SearchTopic(string keyword, [FromUri] string[] group = null)
        {
            string me = whoami();

            string[] joinedGroup = MembershipHelper.CheckJoinedGroup(me, group);
            var      topiclist   = _topicManager.SearchTopic(keyword, joinedGroup);

            //var disptopiclist = new List<DisplayTopic>();

            //foreach (var t in topiclist)
            //{
            //    disptopiclist.Add(new DisplayTopic(t, IsFavouriteTopic(t.Id)));
            //}

            return(_topicManager.ToDisplayTopicList(topiclist, me));
        }
示例#4
0
        public DisplayMessagePagination TopicLine(string topic, DateTime start, DateTime end, int count = 25, [FromUri] string[] group = null, string token = null)
        {
            string me = whoami();
            var    t  = _topicManager.FindTopicByName(topic, MembershipHelper.CheckJoinedGroup(whoami(), group));

            if (t == null)
            {
                return(null);
            }

            TableContinuationToken tok = Utils.String2Token(token);

            if (tok == null)
            {
                _topicManager.clearUnreadMsgCountOfFavouriteTopic(me, t.Id);
            }
            return(CreateDisplayMsgPag(_messageManager.TopicLine(t.Id.ToString(), start, end, count, tok)));
        }