Exemplo n.º 1
0
        public static void DeleteTopicTags(int topicid)
        {
            //UPDATE [dnt_tags] SET [count]=[count]-1,[fcount]=[fcount]-1
            //WHERE EXISTS (SELECT [tagid] FROM [dnt_topictags] WHERE [tid] = @tid AND [tagid] = [dnt_tags].[tagid])

            //DELETE FROM [dnt_topictags] WHERE [tid] = @tid

            var list = TopicTag.FindAllByTid(topicid);

            if (list.Count <= 0)
            {
                return;
            }

            using (var trans = Meta.CreateTrans())
            {
                foreach (var tp in list)
                {
                    tp.Delete();

                    var tag = FindByID(tp.TagID);
                    if (tag == null)
                    {
                        continue;
                    }

                    tag.Count--;
                    tag.FCount--;
                    tag.Update();
                }
            }
        }
Exemplo n.º 2
0
        public static EntityList <Tag> GetTagsListByTopic(int topicid)
        {
            var list = TopicTag.FindAllByTid(topicid);

            if (list.Count <= 0)
            {
                return(new EntityList <Tag>());
            }

            //return FindAll(_.ID.In(list.GetItem<Int32>(TopicTag._.TagID)), null, null, 0, 0);
            return(FindAllByIDs(list.GetItem <Int32>(TopicTag._.TagID).ToArray()));
        }