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

            formaPagamentoDomainService.Delete(formaPagamento);

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

            return(Unit.Value);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                DeleteFormaPagamentoCommand command = new DeleteFormaPagamentoCommand {
                    Id = id
                };
                await formaPagamentoApplicationService.Delete(command);

                return(Ok(new { message = "Forma de Pagamento excluída com sucesso!" }));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
Exemplo n.º 3
0
 public Task Delete(DeleteFormaPagamentoCommand command)
 {
     return(mediator.Send(command));
 }