Example #1
0
        public async Task <IActionResult> Create([FromServices] BlogCommandHandlerFactory blogCommandHandlerFactory, AddBlogAsyncCommand command)
        {
            command.OwnerId = _userManager.GetUserId(User);
            var handler  = blogCommandHandlerFactory.Build(command);
            var response = await handler.Execute();

            return(RedirectToAction("Profile", "Account"));
        }
Example #2
0
        public async Task <IActionResult> Delete([FromServices] BlogCommandHandlerFactory blogCommandHandlerFactory, int id)
        {
            var command = new DeleteBlogAsyncCommand {
                Id = id
            };
            var handler  = blogCommandHandlerFactory.Build(command);
            var response = await handler.Execute();

            return(Ok());
        }