Example #1
0
        public ActionResult AgregarLocal()
        {
            if (Request.IsAuthenticated)
            {
                tb_local reg = new tb_local();
                return View(reg);
            }
            else
            {
                return RedirectToAction("Login", "Login");

            }
        }
Example #2
0
        public ActionResult AgregarLocal(tb_local reg)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("Error", "Error al grabar Local");
                return View(reg);
            }

            db.Local.Add(reg);
            db.SaveChanges();
            TempData["SUCCESS"] = "Local registrado correctamente.";

            return RedirectToAction("Index");
        }
Example #3
0
        public ActionResult EditarLocal(tb_local reg)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("Error", "Error al grabar Local");
                return View(reg);
            }

            tb_local local = db.Local.Where(nl => nl.id_local == reg.id_local).FirstOrDefault();
            local.nom_local = reg.nom_local;
            local.dir_local = reg.dir_local;
            local.telefono = reg.telefono;

            db.SaveChanges();

            return RedirectToAction("Index");
        }