Пример #1
0
        public async Task <ActionResult> Delete(int id)
        {
            var command = new DeleteBlogPostCommand()
            {
                Id = id
            };

            await _mediator.Send(command);

            return(NoContent());
        }
Пример #2
0
        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));
        }
Пример #3
0
 public DeleteBlogPostOperation(DeleteBlogPostCommand command)
 {
     _command = command;
 }
Пример #4
0
        public JsonResult DeletePost(DeleteBlogPostCommand command)
        {
            var result = _commandBus.Send(command);

            return(JsonMessage(result));
        }