public async Task Handle(UploadImage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } var product = await _productRepository.Get(message.Id); await product.UploadImage(_imageStoreService, message.File.OpenReadStream(), Path.GetExtension(message.File.FileName)); await _productRepository.Save(product); }
public async Task <IActionResult> UploadImage(UploadImage uploadImage) { await _mediator.Send(uploadImage); return(NoContent()); }