Exemplo n.º 1
0
        /// <summary>
        /// 获取热门标签
        /// </summary>
        /// <param name="QueryTagsParameter"></param>
        /// <returns></returns>
        public string[] QueryTags(QueryTagsParameter param)
        {
            using (var context = base.CreateContext())
            {
                var q = from t in context.News
                        where t.AppID == param.AppID &&
                        t.Tag.Length > 0
                        orderby t.ViewCount descending
                        select t.Tag;
                var q2 = from t in q.Take(param.TakeCount).ToList()
                         from t2 in t.Split(',')
                         group t by t2 into g
                         orderby g.Count() descending
                         select g.Key;

                return(q2.Take(param.TakeCount).ToArray());
            }
        }
Exemplo n.º 2
0
        public string[] QueryTags(QueryTagsParameter param)
        {
            var repository = new NewsRepository();

            return(repository.QueryTags(param));
        }