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); } }
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(); } } }