private bool ValidProductItem(Products.ProductItem productItem) { if (productItem.IsValid()) { return(true); } NotifyErrorValidations(productItem.ValidationResult); return(false); }
public void Handle(CreateProductItemCommand message) { var productItem = new Products.ProductItem(message.ProductId, message.ProductItemId, message.Units); if (!ValidProductItem(productItem)) { return; } // Criar demais validações de negócio _productRepository.AddProductItem(productItem); if (Commit()) { _bus.RaiseEvent(new CreatedProductItemEvent(productItem.Id, productItem.ProductId, productItem.ProductItemId, productItem.Units)); } }