Esempio n. 1
0
        private bool ValidBrand(Products.Brand brand)
        {
            if (brand.IsValid())
            {
                return(true);
            }

            NotifyErrorValidations(brand.ValidationResult);
            return(false);
        }
Esempio n. 2
0
        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));
            }
        }