Example #1
0
 public ActionResult Edit([Bind(Include = "Id,Nombre,Saldo")] CuentaModel cuentaModel)
 {
     if (ModelState.IsValid)
     {
         _repository.Actualizar(cuentaModel);
         return(RedirectToAction("Index"));
     }
     return(View(cuentaModel));
 }
Example #2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            int rowindex = dgvDatos.CurrentCell.RowIndex;
            var id       = (int)dgvDatos.Rows[rowindex].Cells[0].Value;
            var cta      = CuentasRepository.ObtenerCuentaPorId(id);

            using (var f = new frmEdiciĆ³n(cta))
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        CuentasRepository.Actualizar(cta.Id, f.DescripciĆ³n, f.Estado, f.SaldoInicial);
                        ConsultarDatos();
                    }
                    catch (Exception ex)
                    {
                        CustomMessageBox.ShowError(ex.Message);
                    }
                    dgvDatos.SetRow(r => Int32.Parse(r.Cells[0].Value.ToString()) == cta.Id);
                }
            }
        }