예제 #1
0
        public override RemoveProductCommand Handle(RemoveProductCommand removeProductCommand)
        {
            ProductReference productReference;

            using (var scope = _productsDao.BeginTransaction())
            {
                productReference = _productsDao.FindById(removeProductCommand.ProductId);
                _productsDao.Delete(removeProductCommand.ProductId);

                scope.Commit();
            }

            return(base.Handle(removeProductCommand));
        }
예제 #2
0
        public override RemoveProductCommand Handle(RemoveProductCommand removeProductCommand)
        {
            Product product;

            using (var scope = _productsDao.BeginTransaction())
            {
                product = _productsDao.FindById(removeProductCommand.ProductId);
                _productsDao.Delete(removeProductCommand.ProductId);
            }

            if (product != null)
            {
                _commandProcessor.Publish(new ProductRemovedEvent(product.Id, product.ProductName, product.ProductDescription, product.ProductPrice));
            }

            return(base.Handle(removeProductCommand));
        }