public ActionResult Carga([Bind(Include = "Nombre, Apellido, DNI, Email, Celular, NroRegistro, Ciudad, IdChofer")] Chofer Chofer)
 {
     if (ModelState.IsValid)
     {
         context.Choferes.Add(Chofer);
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(Chofer));
 }
        public ActionResult Create([Bind(Include = "IdVehiculo,IdChofer,Marca,Modelo,Matricula,Caracteristicas")] Vehiculo vehiculo)
        {
            if (ModelState.IsValid)
            {
                db.Vehiculos.Add(vehiculo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdChofer = new SelectList(db.Choferes, "IdChofer", "Nombre", vehiculo.IdChofer);
            return(View(vehiculo));
        }
 public ActionResult Crear(Solicitud s)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     try
     {
         using (Conection())
         {
             db.Solicitud.Add(s);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", "Error encontrado: " + ex.Message);
         return(View());
     }
 }//Fin Crear sobrecargado
예제 #4
0
 public ActionResult Crear(Bitacora b)
 {
     try
     {
         using (Conection())
         {
             db.Bitacora.Add(b);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e)
     {
         ModelState.AddModelError("", "Error encontrado: " + e.Message);
         return(View());
     }
 }//Fin Crear-POST