public async Task <ActionResult> DeleteConfirmed(int id) { juzgado juzgado = await db.juzgado.FindAsync(id); db.juzgado.Remove(juzgado); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "id,nombre,lugar,piso,ciudad,nombre_juez,apellido_juez,descripcion,tipoId")] juzgado juzgado) { if (ModelState.IsValid) { db.Entry(juzgado).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } LlenarTipoJuzgadoDropDownList(juzgado.tipoId); return(View(juzgado)); }
// GET: juzgados/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } juzgado juzgado = await db.juzgado.FindAsync(id); if (juzgado == null) { return(HttpNotFound()); } return(View(juzgado)); }
// GET: juzgados/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } juzgado juzgado = await db.juzgado.FindAsync(id); if (juzgado == null) { return(HttpNotFound()); } LlenarTipoJuzgadoDropDownList(juzgado.tipoId); return(View(juzgado)); }
public async Task <ActionResult> Create([Bind(Include = "id,nombre,lugar,piso,ciudad,nombre_juez,apellido_juez,descripcion,tipoId")] juzgado juzgado) { try { if (ModelState.IsValid) { db.juzgado.Add(juzgado); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } } catch (RetryLimitExceededException) { ModelState.AddModelError("", "No se pudo grabar los cambios. Trate de nuevo, y si persiste el problema comunicarse con el administrador."); } LlenarTipoJuzgadoDropDownList(juzgado.tipoId); return(View(juzgado)); }