public async Task <ActionResult> DeleteConfirmed(int id) { telefono_persona telefono_persona = await db.telefono_persona.FindAsync(id); db.telefono_persona.Remove(telefono_persona); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> EditTelefono(telefono telefono, telefono_persona telefono_Persona) { if (ModelState.IsValid) { db.Entry(telefono).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction(string.Format("Details/{0}", telefono_Persona.personaId))); } return(View(telefono_Persona)); }
public async Task <ActionResult> Edit([Bind(Include = "id,personaId,telefonosId")] telefono_persona telefono_persona) { if (ModelState.IsValid) { db.Entry(telefono_persona).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.personaId = new SelectList(db.persona, "id", "dni", telefono_persona.personaId); ViewBag.telefonosId = new SelectList(db.telefono, "id", "telefono1", telefono_persona.telefonosId); return(View(telefono_persona)); }
// GET: telefono_persona/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } telefono_persona telefono_persona = await db.telefono_persona.FindAsync(id); if (telefono_persona == null) { return(HttpNotFound()); } return(View(telefono_persona)); }
// GET: telefono_persona/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } telefono_persona telefono_persona = await db.telefono_persona.FindAsync(id); if (telefono_persona == null) { return(HttpNotFound()); } ViewBag.personaId = new SelectList(db.persona, "id", "dni", telefono_persona.personaId); ViewBag.telefonosId = new SelectList(db.telefono, "id", "telefono1", telefono_persona.telefonosId); return(View(telefono_persona)); }
public async Task <ActionResult> CreateTelefono(telefono telefono, int id) { if (ModelState.IsValid) { db.telefono.Add(telefono); var telefono_Persona = new telefono_persona { personaId = id, telefonosId = telefono.id }; db.telefono_persona.Add(telefono_Persona); await db.SaveChangesAsync(); return(RedirectToAction(string.Format("Details/{0}", telefono_Persona.personaId))); } return(View()); }
// GET: telefonos/Create public async Task <ActionResult> CreateTelefono(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } persona persona = await db.persona.FindAsync(id); if (persona == null) { return(HttpNotFound()); } var telefono_personaId = new telefono_persona { personaId = persona.id }; return(View(telefono_personaId)); }