Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tbDanio tbDanio = db.tbDanio.Find(id);

            db.tbDanio.Remove(tbDanio);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 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));
 }
Exemple #3
0
        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));
        }
Exemple #4
0
        // 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);
        }