Exemple #1
0
        public List <DadoCadastral> ListaCliente()
        {
            List <DadoCadastral> Usuarios = new List <DadoCadastral>();

            SqlCommand comando = new SqlCommand();

            comando.Connection  = AbreConexao;
            comando.CommandText = @"Select *from DadosCadastrais";

            SqlDataReader leitura = comando.ExecuteReader();

            while (leitura.Read())
            {
                DadoCadastral Lista = new DadoCadastral();
                Lista.Id       = (int)leitura["id"];
                Lista.Nome     = (string)leitura["Nome"];
                Lista.Telefone = (string)leitura["Telefone"];
                Lista.Tipo     = (string)leitura["Tipo"];

                Usuarios.Add(Lista);
            }


            return(Usuarios);
        }
Exemple #2
0
        public IActionResult Index(DadoCadastral Cadastro)
        {
            using (CadastroUsuariocs DadoCliente = new CadastroUsuariocs())
            {
                DadoCliente.Create(Cadastro);



                return(RedirectToAction("Index"));
            }
        }
Exemple #3
0
        public IActionResult Edit([Bind(include: "Id,Nome,Telefone,QtdeProduto,Tipo")] DadoCadastral form)
        {
            DadoCadastral procura = new DadoCadastral();

            procura.Id       = form.Id;
            procura.Nome     = form.Nome;
            procura.Telefone = form.Telefone;
            procura.Tipo     = form.Tipo;


            return(View());
        }
Exemple #4
0
        public IActionResult Edit(int id)
        {
            DadoCadastral dados = new DadoCadastral();

            using (CadastroUsuariocs DadoCli = new CadastroUsuariocs())
            {
                DadoCli.AtualizarDado(id);


                return(View());
            }
        }
Exemple #5
0
        public void Create(DadoCadastral Cadastro)
        {
            SqlCommand comando = new SqlCommand();

            comando.Connection  = AbreConexao;
            comando.CommandText = @"INSERT INTO DadosCadastrais values(@Nome,@Telefone,@Tipo)";

            comando.Parameters.AddWithValue("@Nome", Cadastro.Nome);
            comando.Parameters.AddWithValue("@Telefone", Cadastro.Telefone);
            comando.Parameters.AddWithValue("@Tipo", Cadastro.Tipo);


            comando.ExecuteNonQuery();
        }
Exemple #6
0
        public void AtualizarDado(int Id)
        {
            SqlCommand comando = new SqlCommand();

            comando.Connection = AbreConexao;
            comando.Parameters.AddWithValue("@Id", Id);
            comando.CommandText = @"Update DadosCadastrais set Nome=@Nome,Telefone=@Telefone,Tipo=@Tipo where id=@Id";


            DadoCadastral UsuarioAtualiza = new DadoCadastral();

            comando.Parameters.AddWithValue("@id", UsuarioAtualiza.Id);
            comando.Parameters.AddWithValue("@Nome", UsuarioAtualiza.Nome);
            comando.Parameters.AddWithValue("@Telefone", UsuarioAtualiza.Telefone);
            comando.Parameters.AddWithValue("@Tipo", UsuarioAtualiza.Tipo);



            comando.ExecuteNonQuery();
        }