public Identity Save(Tag tag) { if (tag == null || string.IsNullOrEmpty(tag.Name)) { return null; } Tag existingTag = this.GetTagByName(tag.Name); if (existingTag != null) { return TagStore.Save(tag, existingTag.GetIdentity()); } return TagStore.Save(tag); }
public void Delete(Tag tag) { TagStore.Delete(tag); }
public PageDataCollection GetPagesByTag(Tag tag, PageReference rootPageReference) { if (tag == null || tag.PermanentLinks == null) { return null; } IList<PageReference> descendantPageReferences = DataFactory.Instance.GetDescendents(rootPageReference); if (descendantPageReferences == null || descendantPageReferences.Count < 1) { return null; } var pages = new PageDataCollection(); foreach (Guid pageGuid in tag.PermanentLinks) { var pageReference = TagsHelper.GetPageReference(pageGuid); if (descendantPageReferences.FirstOrDefault(p => p.ID == pageReference.ID) != null) { pages.Add(DataFactory.Instance.GetPage(pageReference)); } } return pages; }
public PageDataCollection GetPagesByTag(Tag tag) { if (tag == null) { return null; } var pageLinks = new List<Guid>(); if (tag.PermanentLinks == null) { var tempTerm = this._tagService.GetTagByName(tag.Name); if (tempTerm != null) { pageLinks = tempTerm.PermanentLinks.ToList(); } } else { pageLinks = tag.PermanentLinks.ToList(); } var pages = new PageDataCollection(); foreach (Guid pageGuid in pageLinks) { pages.Add(DataFactory.Instance.GetPage(TagsHelper.GetPageReference(pageGuid))); } return pages; }
public Identity Save(Tag tag) { return _tagRepository.Save(tag); }
private static object ToAutoComplete(Tag tag) { return new { name = tag.Name, id = tag.Name }; }
public Tag Save(Guid pageGuid, string name) { if (string.IsNullOrEmpty(name)) { return null; } Tag tag = this.GetTagByName(name); if (tag == null) { tag = new Tag { Count = 1, Name = name, PermanentLinks = new List<Guid>() { pageGuid } }; } else { if (tag.PermanentLinks == null) { tag.PermanentLinks = new List<Guid>() { pageGuid }; tag.Count = tag.Count + 1; } else { if (!tag.PermanentLinks.Contains(pageGuid)) { tag.PermanentLinks.Add(pageGuid); tag.Count = tag.Count + 1; } } } this.Save(tag); return tag; }