private void AtualizaTabela() { dataGridView1.Rows.Clear(); List <Preco> lista = repository.ObterTodos(); foreach (Preco preco in lista) { dataGridView1.Rows.Add(new object[] { preco.IdPreco, preco.PrecoHora, preco.DataInicial, preco.DataFinal }); } }
private void button1_Click(object sender, EventArgs e) { switch (cbOpcao.SelectedIndex) { case 0: CarroRepository repository = new CarroRepository(); ExportarPlacas(repository.ObterTodos()); break; case 1: PrecoRepository repository2 = new PrecoRepository(); ExportarPrecos(repository2.ObterTodos()); break; } }