// GET: Padrons/Edit/5 public ActionResult Edit(int?id) { PadronHistorial phistorial = new PadronHistorial(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } phistorial.padron = db.Padrons.Find(id); phistorial.historial = db.HistorialContactoes.Include(s => s.AspNetUser).Where(a => a.FkPadron.Equals(phistorial.padron.Id)).ToList(); ViewBag.votante = new SelectList(db.TipoVotantes, "id", "tipo_votante", phistorial.padron.votante); if (phistorial.padron == null) { return(HttpNotFound()); } return(View(phistorial)); }
public ActionResult Edit(PadronHistorial phistorial) { if (ModelState.IsValid) { if (phistorial.padron.nombre != null && phistorial.padron.paterno != null && phistorial.padron.telefono != null && phistorial.padron.celular != null && phistorial.padron.direccion != null && phistorial.padron.rfc != null && phistorial.padron.curp != null && phistorial.padron.claveElectoral != null && phistorial.padron.email != null) { phistorial.padron.registroCompleto = true; } else { phistorial.padron.registroCompleto = false; } phistorial.padron.fechaUpdate = DateTime.Now.Date; phistorial.padron.usuarioUpdate = User.Identity.GetUserId(); db.Entry(phistorial.padron).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(phistorial)); }