コード例 #1
0
ファイル: TagBR.cs プロジェクト: bsimser/dotnetkicks
        public static WeightedTagList AddUserStoryTags(string tagString, User user, int storyID, int hostID)
        {
            WeightedTagList tags = GetOrInsertTags(tagString, user.IsAdministrator);

            StoryUserHostTagCollection storyUserHostTags = new StoryUserHostTagCollection();

            foreach (WeightedTag tag in tags)
            {
                StoryUserHostTag storyUserHostTag = new StoryUserHostTag(); //TODO: GJ: move to WeightedTag.ToStoryUserHostTag()
                storyUserHostTag.StoryID = storyID;
                storyUserHostTag.HostID  = hostID;
                storyUserHostTag.UserID  = user.UserID;
                storyUserHostTag.TagID   = tag.TagID;
                storyUserHostTags.Add(storyUserHostTag);
                StoryCache.ClearUserTaggedStories(tag.TagName, user.UserID, storyID);
            }

            storyUserHostTags.BatchSave();

            UserAction.RecordTag(hostID, user, Story.FetchByID(storyID), tags);

            //when a user adds a tag, we need to mark the story as updated
            //so update the index during the incremental crawl
            Story story = Story.FetchByID(storyID);

            story.UpdatedOn = DateTime.Now;
            story.Save();

            return(tags);
        }
コード例 #2
0
 public void UnTagStory(int storyID, int tagID)
 {
     DemandUserAuthentication();
     StoryUserHostTag.Destroy(storyID, KickUserProfile.UserID, HostProfile.HostID, tagID);
 }