public async Task <Unit> Handle(UpdateFormaPagamentoCommand request, CancellationToken cancellationToken)
        {
            var formaPagamento = mapper.Map <FormaPagamento>(request);

            var validate = new FormaPagamentoValidation().Validate(formaPagamento);

            if (!validate.IsValid)
            {
                throw new ValidationException(validate.Errors);
            }

            formaPagamentoDomainService.Update(formaPagamento);

            await mediator.Publish(new FormaPagamentoNotification
            {
                Action         = ActionNotification.Atualizar,
                FormaPagamento = formaPagamento
            });

            return(Unit.Value);
        }
Exemplo n.º 2
0
 public override bool EhValido()
 {
     ValidationResult = new FormaPagamentoValidation().Validate(this);
     return(ValidationResult.IsValid);
 }