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);
        }
Ejemplo n.º 2
0
 public Task HandleAsync(ChangeProductTypeCommand command)
 {
     return(_writeRepository.UpdateTypeAsync(command.ProductType, command.Id));
 }
Ejemplo n.º 3
0
 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());
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> ChangeProductTypeAsync([FromBody] ChangeProductTypeCommand command)
        {
            await Mediator.SendAsync(command).ConfigureAwait(false);

            return(Ok());
        }