public async Task HandleAsync(ChangeProductTypeCommand 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.ChangeProductType(command); await _repo.SaveAsync(aggregateProduct, cancellationToken); }
public Task HandleAsync(ChangeProductTypeCommand command) { return(_writeRepository.UpdateTypeAsync(command.ProductType, command.Id)); }
public void ChangeProductType(ChangeProductTypeCommand command) { ApplyChange(new ChangedProductTypeEvent(command.ProductType, this, command)); }
public async Task <IActionResult> ChangeProductType([FromBody] ChangeProductTypeCommand command) { await _commandSender.SendAsync(command); return(Ok()); }
public async Task <IActionResult> ChangeProductTypeAsync([FromBody] ChangeProductTypeCommand command) { await Mediator.SendAsync(command).ConfigureAwait(false); return(Ok()); }