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

            db.habitos.Remove(habitos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult Details(int id = 0)
        {
            habitos habitos = db.habitos.Find(id);

            if (habitos == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(habitos));
        }
Exemple #3
0
        public ActionResult Delete(int id = 0)
        {
            habitos habitos = db.habitos.Find(id);

            if (habitos == null)
            {
                return(HttpNotFound());
            }
            return(View(habitos));
        }
Exemple #4
0
 public ActionResult Edit(habitos habitos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(habitos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create", "Familiar", new { id = habitos.hab_id }));
     }
     ViewBag.hab_fumo      = opcion(habitos.hab_fumo);
     ViewBag.hab_fuma      = opcion(habitos.hab_fuma);
     ViewBag.hab_alcohol   = opcion(habitos.hab_alcohol);
     ViewBag.hab_drogas    = opcion(habitos.hab_drogas);
     ViewBag.hab_ejercicio = opcion(habitos.hab_ejercicio);
     return(PartialView(habitos));
 }
Exemple #5
0
        public ActionResult Edit(int id = 0)
        {
            habitos habitos = db.habitos.Find(id);

            if (habitos == null)
            {
                return(RedirectToAction("Create", new { id = id }));
            }

            ViewBag.hab_fumo      = opcion(habitos.hab_fumo);
            ViewBag.hab_fuma      = opcion(habitos.hab_fuma);
            ViewBag.hab_alcohol   = opcion(habitos.hab_alcohol);
            ViewBag.hab_drogas    = opcion(habitos.hab_drogas);
            ViewBag.hab_ejercicio = opcion(habitos.hab_ejercicio);
            return(PartialView(habitos));
        }
Exemple #6
0
        public ActionResult Create(int id)
        {
            habitos habitos = db.habitos.Find(id);

            if (habitos != null)
            {
                return(RedirectToAction("Edit", new { id = id }));
            }
            ViewBag.hab_id        = id;
            ViewBag.hab_fumo      = opcion();
            ViewBag.hab_fuma      = opcion();
            ViewBag.hab_alcohol   = opcion();
            ViewBag.hab_drogas    = opcion();
            ViewBag.hab_ejercicio = opcion();
            return(PartialView());
        }