public virtual bool MarkAsSpam(DateTime at, IUser byUser, string fromIPAddress) { Check.Argument.IsNotInFuture(at, "at"); Check.Argument.IsNotNull(byUser, "byUser"); Check.Argument.IsNotEmpty(fromIPAddress, "fromIPAddress"); if (CanMarkAsSpam(byUser)) { StoryMarkAsSpam markAsSpam = new StoryMarkAsSpam { Story = this, User = (User)byUser, IPAddress = fromIPAddress, Timestamp = at }; StoryMarkAsSpams.Add(markAsSpam); IoC.Resolve <IMarkAsSpamRepository>().Add(markAsSpam); LastActivityAt = at; return(true); } return(false); }
public bool UnmarkAsSpam(DateTime at, IUser byUser) { Check.Argument.IsNotInvalidDate(at, "at"); Check.Argument.IsNotNull(byUser, "byUser"); if (CanUnmarkAsSpam(byUser)) { var spam = this.GetMarkAsSpam(byUser); this.UnmarkSpam(spam); StoryMarkAsSpams.Remove((StoryMarkAsSpam)spam); LastActivityAt = at; return(true); } return(false); }
public bool MarkAsSpam(DateTime at, IUser byUser, string fromIpAddress) { Check.Argument.IsNotInFuture(at, "at"); Check.Argument.IsNotNull(byUser, "byUser"); Check.Argument.IsNotEmpty(fromIpAddress, "fromIpAddress"); if (CanMarkAsSpam(byUser)) { var spamStory = this.MarkSpam(at, byUser, fromIpAddress); StoryMarkAsSpams.Add((StoryMarkAsSpam)spamStory); LastActivityAt = at; return(true); } return(false); }
public virtual bool UnmarkAsSpam(DateTime at, IUser byUser) { Check.Argument.IsNotInvalidDate(at, "at"); Check.Argument.IsNotNull(byUser, "byUser"); if (CanUnmarkAsSpam(byUser)) { IMarkAsSpamRepository repository = IoC.Resolve <IMarkAsSpamRepository>(); StoryMarkAsSpam spam = (StoryMarkAsSpam)repository.FindById(Id, byUser.Id); repository.Remove(spam); StoryMarkAsSpams.Remove(spam); LastActivityAt = at; return(true); } return(false); }