public TransferenciaResponse Transferir(TransferenciaRequest transferenciaRequest)
        {
            TransferenciaResponse response = new TransferenciaResponse();

            try
            {
                _servicoContaCorrente.Transferir(transferenciaRequest.ContaCorrenteCredito, transferenciaRequest.ContaCorrenteDebito, transferenciaRequest.Montante);
                response.Successo = true;
                return(response);
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        public IActionResult Transferir([FromBody] TransferenciaRequest transferenciaRequest)
        {
            HttpRequestMessage request = new HttpRequestMessage();

            try
            {
                TransferenciaResponse response = _servicoBank.Transferir(transferenciaRequest);
                response.Mensagem = "Transferência efetuada com sucesso!";
                return(Ok(response));
            }
            catch (SaldoInsuficienteException ex)
            {
                return(BadRequest(ex));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }