예제 #1
0
        public Result <Transaction> Handle(SalvarTransacaoCommand command)
        {
            var transacao = _transacaoRepository.Salvar(command.Descricao,
                                                        command.Valor,
                                                        command.Data);

            return(new Result <Transaction> {
                Dado = transacao
            });
        }
예제 #2
0
        public Transaction SalvarTransacao([FromBody] TransacaoDTO dto)
        {
            var command = new SalvarTransacaoCommand
            {
                Data      = dto.Data,
                Descricao = dto.Descricao,
                Valor     = dto.Valor
            };

            var handler = new TransacaoCommandHandler();
            var result  = handler.Handle(command);

            return(result.Dado);
        }