示例#1
0
        public RetornService Post([FromBody] Cliente data)
        {
            RetornService retorno = new RetornService();

            try
            {
                data.RegistrarCliente();
                retorno.Result      = true;
                retorno.ErroMessage = string.Empty;
            }
            catch (Exception)
            {
                retorno.Result      = false;
                retorno.ErroMessage = "Erro ao tentar registrar novo Cliente";
            }
            return(retorno);
        }
示例#2
0
        public RetornService Aualizar(int id, [FromBody] Cliente value)
        {
            RetornService retorno = new RetornService();

            try
            {
                value.Id = id;
                value.UpdatingClient();
                retorno.Result      = true;
                retorno.ErroMessage = string.Empty;
            }
            catch (Exception)
            {
                retorno.Result      = false;
                retorno.ErroMessage = "Erro ao tentar Atualizar um Cliente";
            }
            return(retorno);
        }
示例#3
0
        public RetornService Delete(int id)
        {
            RetornService retornAuth = new RetornService();

            try
            {
                retornAuth.Result      = true;
                retornAuth.ErroMessage = "Excluído com sucesso !";
                authentication.Authentication();
                new Cliente().excluir(id);
            }
            catch (Exception ex)
            {
                retornAuth.Result      = false;
                retornAuth.ErroMessage = "Erro ao excluir por este Motivo : " + ex.Message;
            }
            return(retornAuth);
        }
示例#4
0
        public Cliente ClientId(int id)
        {
            //  DAL dll = new DAL();
            //  string sql = $"SELECT * FROM Cliente where id = {id}";
            //DataTable dados = dll.find(sql);
            //return dados.Rows[0]["nome"].ToString();
            RetornService retornAuth = new RetornService();

            try
            {
                retornAuth.Result      = true;
                retornAuth.ErroMessage = "Cliente com ID...";
                authentication.Authentication();
                //new Cliente().FindId(id);
            }
            catch (Exception e)
            {
                retornAuth.Result      = false;
                retornAuth.ErroMessage = "Cliente com ID...";
            }
            return(retornAuth.Result ? new Cliente().FindId(id) : null);
        }
示例#5
0
        public List <Cliente> List()
        {
            RetornService retornAuth = new RetornService();

            //DAL db = new DAL();
            //DAL db = new DAL();
            //string sql = "INSERT INTO cliente (nome, data_cadastro, cpf_cnpj, data_nascimento, tipo, telefone, email, cep, logradouro, numero, bairro, complemento, cidade, uf) values('Rafael Carvalho', '2019/08/11', '111222333-55', '1988/12/12', 'M', '988776655', '*****@*****.**', '0987687', 'rua 001', '22', 'Teste', '', 'São Paulo', 'SP')";
            //db.executaSQL(sql);
            //db.executaSQL(sql);
            //return new string[] { "value1", "value2" };
            try
            {
                retornAuth.Result      = true;
                retornAuth.ErroMessage = "Solicitação Efetuada com sucesso.";
                authentication.Authentication();
                //new Cliente().list();
            }
            catch (Exception ex)
            {
                retornAuth.Result      = false;
                retornAuth.ErroMessage = "Erro na listagem por este Motivo: " + ex.Message;
            }
            return(retornAuth.Result ? new Cliente().list() : null);
        }