public static WeightedTagList GetOrInsertTags(string tagString, bool isAdministrator) { List<string> rawTags = TagHelper.DistillTagInput(tagString, isAdministrator); WeightedTagList tags = new WeightedTagList(); TagCollection newTags = new TagCollection(); foreach (string tagIdentifier in rawTags) { //TODO: GJ: get from cache Tag tag = Tag.FetchTagByIdentifier(tagIdentifier); if (tag == null) { tag = new Tag(); tag.TagIdentifier = tagIdentifier; newTags.Add(tag); } else { tags.Add(new WeightedTag(tag.TagID, tag.TagIdentifier, 1)); } } // newTags.BatchSave(); //TODO: GJ: does BatchSave update identity colums after save? foreach (Tag newTag in newTags) { newTag.Save(); //TODO: GJ: does BatchSave update identity colums after save? tags.Add(new WeightedTag(newTag.TagID, newTag.TagIdentifier, 1)); } return tags; }
public void Insert(string TagIdentifier) { Tag item = new Tag(); item.TagIdentifier = TagIdentifier; item.Save(UserName); }
public void Update(int TagID,string TagIdentifier) { Tag item = new Tag(); item.TagID = TagID; item.TagIdentifier = TagIdentifier; item.MarkOld(); item.Save(UserName); }