public async Task HandleAsync(ChangeProductBrandCommand command, CancellationToken cancellationToken = default) { var aggregateProduct = await _repo.GetAsync(command.Id, cancellationToken : cancellationToken); if (aggregateProduct == null) { throw new CannotFindException("No data on this Id"); } aggregateProduct.ChangeProductBrand(command); await _repo.SaveAsync(aggregateProduct, cancellationToken); }
public Task HandleAsync(ChangeProductBrandCommand command) { return(_writeRepository.UpdateBrandAsync(command.Brand, command.Id)); }
public void ChangeProductBrand(ChangeProductBrandCommand command) { ApplyChange(new ChangedProductBrandEvent(command.Brand, this, command)); }
public async Task <IActionResult> ChangeProductBrand([FromBody] ChangeProductBrandCommand command) { await _commandSender.SendAsync(command); return(Ok()); }
public async Task <IActionResult> ChangeProductBrandAsync([FromBody] ChangeProductBrandCommand command) { await Mediator.SendAsync(command).ConfigureAwait(false); return(Ok()); }