예제 #1
0
        public async Task <Unit> Handle(DeleteProdutoCommand request, CancellationToken cancellationToken)
        {
            var produto = mapper.Map <Produto>(request);

            if (produto == null)
            {
                throw new Exception("Produto não encontrado.");
            }

            produtoDomainService.Remove(produto);

            await mediator.Publish(new ProdutoNotification
            {
                Produto = produto,
                Action  = ActionNotification.Excluir
            });

            return(Unit.Value);
        }