public ActionResult Editar(int id) { ContaPagar contaPagar = repository.ObterPeloId(id); ViewBag.ContaPagar = contaPagar; ClienteRepository clienteRepository = new ClienteRepository(); ViewBag.Clientes = clienteRepository.ObterTodos(); CategoriaRepository categoriaRepository = new CategoriaRepository(); ViewBag.Categorias = categoriaRepository.ObterTodos(); return(View()); }
public ActionResult Editar(int id) { ContaPagar contaPagar = repository.ObterPeloId(id); ViewBag.ContaPagar = contaPagar; return(View()); }
private void btnEditar_Click(object sender, EventArgs e) { ContaPagarRepository repositorio = new ContaPagarRepository(); int id = Convert.ToInt32(dgvContasPagar.CurrentRow.Cells[0].Value); ContaPagar conta = repositorio.ObterPeloId(id); if (conta != null) { txtNome.Text = conta.Nome; mtbValor.Text = conta.Valor.ToString("0000.00"); cbTipo.Text = conta.Tipo.ToString(); dtpDataVencimento.Text = conta.DataVencimento.ToString(); lblId.Text = conta.Id.ToString(); } }