public async Task <SaveImageResult> Handle(InsertProductImageCommand command, CancellationToken cancellationToken) { var result = new SaveImageResult(); var product = await _productRepository.FindAsync(x => x.Id == command.ProductId); if (product == null) { Notifications.Handle("Produto Não encotrado"); return(null); } foreach (var file in command.Images) { result.Links.Add(file.url); } ; if (!await CommitAsync()) { return(result); } return(result); }
public async Task <IActionResult> SaveProductImages(Guid id, [FromBody] InsertProductImageCommand command) { command.ProductId = id; return(CreateResponse(await _mediator.Send(command, CancellationToken.None))); }