示例#1
0
        public virtual void MarkAsSpam(IStory theStory, string storyUrl, IUser byUser, string fromIPAddress)
        {
            Check.Argument.IsNotNull(theStory, "theStory");
            Check.Argument.IsNotEmpty(storyUrl, "storyUrl");
            Check.Argument.IsNotNull(byUser, "byUser");
            Check.Argument.IsNotEmpty(fromIPAddress, "fromIPAddress");

            if (theStory.MarkAsSpam(SystemTime.Now(), byUser, fromIPAddress))
            {
                _userScoreService.StoryMarkedAsSpam(theStory, byUser);
                _emailSender.NotifyStoryMarkedAsSpam(storyUrl, theStory, byUser);
            }
        }
示例#2
0
        public virtual void MarkAsSpam(IStory theStory, string storyUrl, IUser byUser, string fromIPAddress)
        {
            Check.Argument.IsNotNull(theStory, "theStory");
            Check.Argument.IsNotEmpty(storyUrl, "storyUrl");
            Check.Argument.IsNotNull(byUser, "byUser");
            Check.Argument.IsNotEmpty(fromIPAddress, "fromIPAddress");

            using (IUnitOfWork unitOfWork = UnitOfWork.Begin())
            {
                if (theStory.MarkAsSpam(SystemTime.Now(), byUser, fromIPAddress))
                {
                    _eventAggregator.GetEvent <StoryMarkAsSpamEvent>().Publish(new StoryMarkAsSpamEventArgs(theStory, byUser, storyUrl));

                    unitOfWork.Commit();
                }
            }
        }