示例#1
0
        private void TagContentItem(TagsPartRecord tagsPartRecord, string tagName)
        {
            var tagRecord        = GetTagByName(tagName);
            var tagsContentItems = new ContentTagRecord {
                TagsPartRecord = tagsPartRecord, TagRecord = tagRecord
            };

            _contentTagRepository.Create(tagsContentItems);
        }
示例#2
0
        private void TagContentItem(TagsPartRecord tagsPartRecord, string tagName)
        {
            var tagPart = _orchardServices.ContentManager.Get <TagsPart>(tagsPartRecord.Id, VersionOptions.Latest);

            tagPart.CurrentTags = tagPart.CurrentTags.Concat(new [] { tagName });
            var tagRecord        = GetTagByName(tagName);
            var tagsContentItems = new ContentTagRecord {
                TagsPartRecord = tagsPartRecord, TagRecord = tagRecord
            };

            _contentTagRepository.Create(tagsContentItems);
        }
示例#3
0
        private void UntagContentItem(TagsPartRecord tagsPartRecord, string tagName)
        {
            var tagPart = _orchardServices.ContentManager.Get <TagsPart>(tagsPartRecord.Id, VersionOptions.Latest);

            tagPart.CurrentTags = tagPart.CurrentTags.Where(x => x != tagName);
        }