public override async Task <Guid> Handle(CreateCategoryCommand command, CancellationToken cancellationToken) { var category = CreateCategory(command); await _repository.AddAsync(category, cancellationToken); await _imageStorage.UploadImageAsync( command.ImageUrl, nameof(Category), category.Id.Value, cancellationToken); await _unitOfWork.SaveAsync(cancellationToken); return(category.Id.Value); }
public override async Task <Guid> Handle(CreateProductCommand command, CancellationToken cancellationToken) { var product = CreateProduct(command); await _repository.AddAsync(product, cancellationToken); await _imageStorage.UploadImageAsync( command.ImageUrl, nameof(Product), product.Id.Value, cancellationToken); await _unitOfWork.SaveAsync(cancellationToken); return(product.Id.Value); }