Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            PLACAS pLACAS = db.PLACAS.Find(id);

            //db.PLACAS.Remove(pLACAS);
            pLACAS.Estado = false;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Edit([Bind(Include = "IdPlaca,Placa,Estado,IdInstructor")] PLACAS pLACAS)
        {
            if (ModelState.IsValid)
            {
                bool existeUsuario = db.PLACAS.Any(x => x.Placa.ToUpper() == pLACAS.Placa.ToUpper());

                db.Entry(pLACAS).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.IdInstructor = new SelectList(db.INSTRUCTOR, "IdInstructor", "Nombre", pLACAS.IdInstructor);
            return(View(pLACAS));
        }
Exemplo n.º 3
0
        // GET: PLACAS/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PLACAS pLACAS = db.PLACAS.Find(id);

            if (pLACAS == null)
            {
                return(HttpNotFound());
            }
            return(View(pLACAS));
        }
Exemplo n.º 4
0
        // GET: PLACAS/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PLACAS pLACAS = db.PLACAS.Find(id);

            if (pLACAS == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdInstructor = new SelectList(db.INSTRUCTOR, "IdInstructor", "Nombre", pLACAS.IdInstructor);
            return(View(pLACAS));
        }
Exemplo n.º 5
0
 public ActionResult Create([Bind(Include = "IdPlaca,Placa,IdInstructor,Estado")] PLACAS pLACAS)
 {
     if (ModelState.IsValid)
     {
         bool existeUsuario = db.PLACAS.Any(x => x.Placa.ToUpper() == pLACAS.Placa.ToUpper());
         if (!existeUsuario)
         {
             pLACAS.Estado = true;
             pLACAS.Placa  = pLACAS.Placa.ToUpper();
             db.PLACAS.Add(pLACAS);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.Message = "Ya existe un registro con este número de placa," + pLACAS.Placa + " por favor revise...";
         }
     }
     ViewBag.IdInstructor = new SelectList(db.INSTRUCTOR, "IdInstructor", "Nombre", pLACAS.IdInstructor);
     return(View(pLACAS));
 }