public void AddComment(PostComment comment) { var commentAdding = new CommentAddingEventArgs(this, comment); CommentAdding.Raise(commentAdding); if (commentAdding.Cancel) return; postRepository.SaveComment(comment); var commentAdded = new CommentAddedEventArgs(this, comment); CommentAdded.Raise(commentAdded); }
public Task <PolicyResult <Guid> > Handle(CommentAddedEventArgs request, CancellationToken cancellationToken) { return(this.executionPolicies.DbExecutionPolicy.ExecuteAndCaptureAsync(() => this.repository.AddCommentAsync(request.Comment))); }