Beispiel #1
0
        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));
        }
Beispiel #3
0
 public DeleteBlogPostOperation(DeleteBlogPostCommand command)
 {
     _command = command;
 }
Beispiel #4
0
        public JsonResult DeletePost(DeleteBlogPostCommand command)
        {
            var result = _commandBus.Send(command);

            return(JsonMessage(result));
        }