Beispiel #1
0
 private void listarCadastro()
 {
     using (Cadastro_ClienteEntities bnc = new Cadastro_ClienteEntities())
     {
         var consulta = bnc.cadastro;
         dgDados.ItemsSource = consulta.ToList();
     }
 }
Beispiel #2
0
        private void btSalvar_Click(object sender, RoutedEventArgs e)
        {
            cadastro c = new cadastro();

            c.nome     = txtNome.Text;
            c.cpf      = txtCPF.Text;
            c.endereco = txtEndereço.Text;

            using (Cadastro_ClienteEntities bnc = new Cadastro_ClienteEntities())
            {
                bnc.cadastro.Add(c);
                bnc.SaveChanges();
            }
        }