private bool ValidBrand(Products.Brand brand) { if (brand.IsValid()) { return(true); } NotifyErrorValidations(brand.ValidationResult); return(false); }
public void Handle(CreateBrandCommand message) { var brand = new Products.Brand(message.Name); if (!ValidBrand(brand)) { return; } _productRepository.AddBrand(brand); if (Commit()) { _bus.RaiseEvent(new CreatedBrandEvent(brand.Id, brand.Name)); } }