public ActionResult DeleteConfirmed(int id) { tbDanio tbDanio = db.tbDanio.Find(id); db.tbDanio.Remove(tbDanio); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "codDanio,descripcion,estado")] tbDanio tbDanio) { if (ModelState.IsValid) { db.Entry(tbDanio).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbDanio)); }
public ActionResult Create([Bind(Include = "codDanio,descripcion,estado")] tbDanio tbDanio) { if (ModelState.IsValid) { db.tbDanio.Add(tbDanio); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbDanio)); }
// GET: Danio/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbDanio tbDanio = db.tbDanio.Find(id); if (tbDanio == null) { return(HttpNotFound()); } return(View(tbDanio)); }
public ActionResult Create([Bind(Include = "descripcion,resolucion,costoReparacion")] DanioResolucion danio_resolucion) { tbDanio danio = new tbDanio() { descripcion = danio_resolucion.descripcion, estado = 1 }; tbResolucion resolucion = new tbResolucion() { resolucion = danio_resolucion.resolucion, estado = 1, costoReparacion = danio_resolucion.costoReparacion }; tbDanioResolucion danioResolucion = new tbDanioResolucion(); danioResolucion.tbDanio = danio; danioResolucion.tbResolucion = resolucion; db.tbDanioResolucion.Add(danioResolucion); db.SaveChanges(); return(RedirectToAction("Index")); //ViewBag.codDanio = new SelectList(db.tbDanio, "codDanio", "descripcion", tbDanioResolucion.codDanio); //ViewBag.codResolucion = new SelectList(db.tbResolucion, "codResolucion", "resolucion", tbDanioResolucion.codResolucion); // return View(danio_resolucion); }