示例#1
0
        public ActionResult Create([Bind(Include = "CodigoDeRol,CodigoDeIdentificacionVehiculo,Estado,FechaDeInicio,FechaDeFin")] RolDePersonaPorTipoDeIdentificacionDeVehiculo rolDePersonaPorTipoDeIdentificacionDeVehiculo)
        {
            if (ModelState.IsValid)
            {
                db.ROLPERSONAXTIPOIDEVEHICULO.Add(rolDePersonaPorTipoDeIdentificacionDeVehiculo);
                string mensaje = Verificar(rolDePersonaPorTipoDeIdentificacionDeVehiculo.CodigoDeRol,
                                           rolDePersonaPorTipoDeIdentificacionDeVehiculo.CodigoDeIdentificacionVehiculo);
                if (mensaje == "")
                {
                    db.SaveChanges();

                    TempData["Type"]    = "success";
                    TempData["Message"] = "El registro se realizó correctamente";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.Type    = "warning";
                    ViewBag.Message = mensaje;
                    return(View(rolDePersonaPorTipoDeIdentificacionDeVehiculo));
                }
            }

            return(View(rolDePersonaPorTipoDeIdentificacionDeVehiculo));
        }
示例#2
0
        public ActionResult RealDeleteConfirmed(string CodRol, string CodVeh)
        {
            RolDePersonaPorTipoDeIdentificacionDeVehiculo rolDePersonaPorTipoDeIdentificacionDeVehiculo = db.ROLPERSONAXTIPOIDEVEHICULO.Find(CodRol, CodVeh);

            db.ROLPERSONAXTIPOIDEVEHICULO.Remove(rolDePersonaPorTipoDeIdentificacionDeVehiculo);
            db.SaveChanges();
            TempData["Type"]    = "error";
            TempData["Message"] = "El registro se eliminó correctamente";
            return(RedirectToAction("Index"));
        }
示例#3
0
        public ActionResult Edit([Bind(Include = "CodigoDeRol,CodigoDeIdentificacionVehiculo,Estado,FechaDeInicio,FechaDeFin")] RolDePersonaPorTipoDeIdentificacionDeVehiculo rolDePersonaPorTipoDeIdentificacionDeVehiculo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(rolDePersonaPorTipoDeIdentificacionDeVehiculo).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rolDePersonaPorTipoDeIdentificacionDeVehiculo));

            ViewBag.CodRol = new SelectList(db.ROLPERSONA, "Id", "Descripcion", rolDePersonaPorTipoDeIdentificacionDeVehiculo.CodigoDeRol);
            ViewBag.CodVeh = new SelectList(db.TIPOVEH, "Id", "Descripcion", rolDePersonaPorTipoDeIdentificacionDeVehiculo.CodigoDeIdentificacionVehiculo);
        }
示例#4
0
        public ActionResult DeleteConfirmed(string CodRol, string CodVeh)
        {
            RolDePersonaPorTipoDeIdentificacionDeVehiculo rolDePersonaPorTipoDeIdentificacionDeVehiculo = db.ROLPERSONAXTIPOIDEVEHICULO.Find(CodRol, CodVeh);

            if (rolDePersonaPorTipoDeIdentificacionDeVehiculo.Estado == "I")
            {
                rolDePersonaPorTipoDeIdentificacionDeVehiculo.Estado = "A";
            }
            else
            {
                rolDePersonaPorTipoDeIdentificacionDeVehiculo.Estado = "I";
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }