public Answer(Guid questionId, Contributor contributor, BodyContent body) { Id = Guid.NewGuid(); QuestionId = questionId; Contributor = contributor; Body = body; HappenedDateTime = DateTime.Now; Votes = new List <Vote>(); Comments = new List <Comment>(); }
public void DownVoteAnswer(Guid answerId, Contributor contributor) { const int requiredReputation = 1000; if (contributor.GetReputation() < requiredReputation) { throw new InsufficientReputationException( $@"The contributor '{contributor.Id}', does not have the required reputation to down vote the answer '{answerId}', current reputation: {contributor.GetReputation()}, required reputation: {requiredReputation}"); } }
public void UpVoteAnswer(Guid answerId, Contributor contributor) { const int requiredReputation = 1000; if (contributor.GetReputation() < requiredReputation) { throw new InsufficientReputationException( $@"The contributor '{contributor.Id}', does not have the required reputation to up vote the answer '{answerId}', current reputation: {contributor.GetReputation()}, required reputation: {requiredReputation}"); } var answer = Answers.FirstOrDefault(a => a.Id == answerId); if (answer == null) { throw new InvalidAnswerException(Id, answerId); } answer.UpVote(contributor.Id); }
public int GetContributorReputation() { return(Contributor.GetReputation()); }
public Comment(Contributor contributor, string text) { Contributor = contributor; Text = text; HappenedDateTime = DateTime.Now; }