public ActionResult DeleteConfirmed(int id) { tbl_animales tbl_animales = db.tbl_animales.Find(id); db.tbl_animales.Remove(tbl_animales); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IdAnimal,Nombre,Clase,Sexo,Edad,Raza,Tamaño,FechaNac,Peso,Situacion,Color,Vacunas,Temperamento,Especie,Poblacion")] tbl_animales tbl_animales) { if (ModelState.IsValid) { db.Entry(tbl_animales).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Especie = new SelectList(db.tbl_especies, "IdEspecie", "Nombre", tbl_animales.Especie); ViewBag.Poblacion = new SelectList(db.tbl_poblacion, "IdPob", "IdPob", tbl_animales.Poblacion); return(View(tbl_animales)); }
// GET: tbl_animales/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_animales tbl_animales = db.tbl_animales.Find(id); if (tbl_animales == null) { return(HttpNotFound()); } return(View(tbl_animales)); }
// GET: tbl_animales/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_animales tbl_animales = db.tbl_animales.Find(id); if (tbl_animales == null) { return(HttpNotFound()); } ViewBag.Especie = new SelectList(db.tbl_especies, "IdEspecie", "Nombre", tbl_animales.Especie); ViewBag.Poblacion = new SelectList(db.tbl_poblacion, "IdPob", "IdPob", tbl_animales.Poblacion); return(View(tbl_animales)); }