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); }
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)); } }
public Task Delete(DeleteFormaPagamentoCommand command) { return(mediator.Send(command)); }