public async Task <int> AddBlogPostAsync(string title, string content) { var command = new CreateBlogPostCommand { Content = content, Title = title }; await _addBlogPostHandler.HandleAsync(command); return(command.CreatedId); }
public ActionResult Create(CreateBlogPostCommand command) { if (!ModelState.IsValid) { return(View()); } var result = _commandBus.Send(command); return(View("Create", result.Message)); }
public async Task <string> CreateBlogPostAsync(string title, string content) { var command = new CreateBlogPostCommand { Content = content, Title = title }; await _writeRepository.CreateAsync(new CreateBlogPostOperation(command)); return(command.CreatedBlogPostId ?? throw new Exception()); }
public BlogPostCreation(CreateBlogPostCommand command) { _command = command; }
public CreateBlogPostOperation(CreateBlogPostCommand command) { _command = command; }
public async Task <Guid> CreateAsync(CreateBlogPostCommand command) { return(await Mediator.Send(command)); }