public async Task <ActionResult> Delete(int id) { var command = new DeleteBlogPostCommand() { Id = id }; await _mediator.Send(command); return(NoContent()); }
public async Task DeleteBlogPostCommandHandler_DeletesBlog() { var blogPost = RequestDbContext.BlogPosts.First(); var deleteBlogPostCommand = new DeleteBlogPostCommand() { Id = blogPost.Id }; IRequestHandler <DeleteBlogPostCommand> deleteBlogPostCommandHandler = new DeleteBlogPostCommandHandler(RequestDbContext); await deleteBlogPostCommandHandler.Handle(deleteBlogPostCommand, CancellationToken.None); Assert.Null(await RequestDbContext.BlogPosts.FindAsync(blogPost.Id)); }
public DeleteBlogPostOperation(DeleteBlogPostCommand command) { _command = command; }
public JsonResult DeletePost(DeleteBlogPostCommand command) { var result = _commandBus.Send(command); return(JsonMessage(result)); }