Example #1
0
        public RespostaJson CriarUsuario(Usuario usuario)
        {
            RespostaJson resposta;

            try
            {
                Servicos.ServicoUsuario serv = new Servicos.ServicoUsuario();
                serv.CriarUsuario(usuario);
            }
            catch (System.Exception ex)
            {
                resposta = new RespostaJson()
                {
                    Status = "false", Msg = ex.Message
                };
            }

            return(new RespostaJson()
            {
                Status = "true", Msg = "Cadastro efetuado com sucesso"
            });
        }
Example #2
0
        public RespostaJson EfetuarTransacao(string cpf, string contaDestino, string agenciaDestino, decimal valor, int tipo)
        {
            Servicos.ServicoAtm serv    = new Servicos.ServicoAtm();
            RespostaJson        retorno = new RespostaJson();

            try
            {
                switch (tipo)
                {
                case 1:
                    serv.EfetuarDeposito(contaDestino, agenciaDestino, valor);
                    retorno = new RespostaJson()
                    {
                        Status = "true", Msg = "Deposito efetuado com sucesso"
                    };
                    break;

                case 3:
                    serv.EfetuarTransferencia(cpf, contaDestino, agenciaDestino, valor);
                    retorno = new RespostaJson()
                    {
                        Status = "true", Msg = "Transferência efetuado com sucesso"
                    };
                    break;
                }

                return(retorno);
            }
            catch (System.Exception ex)
            {
                return(new RespostaJson()
                {
                    Status = "false", Msg = ex.Message
                });
            }
        }