public ActionResult Create(corrida corrida)
        {
            if (ModelState.IsValid)
            {
                int ori = Convert.ToInt32(corrida.origen);
                int dest = Convert.ToInt32(corrida.destino);

                try
                {
                    corrida.itinerario = db.itineriarios.Where(x => x.origen == ori && x.destino == dest).Select(x => x.id).First();
                    //itineriario iti = db.itineriarios.Where(x => x.origen == ori && x.destino == dest).First();
                    corrida.estatus = "DISPONIBLE";
                    //corrida.servicio = "PRIMERA";
                    Random random = new Random();
                    int folio = random.Next(0,10000);
                    corrida.folio = folio.ToString();
                    corrida.total = 45;
                    corrida.fecha = DateTime.Now;
                    corrida.disponibles = 40;
                    corrida.iva = calcularIva(corrida.precio, 16);
                    corrida.total = corrida.precio + corrida.iva;
                }
                catch (Exception e)
                {
                    corrida.itinerario = -1;
                }
                if (corrida.itinerario == -1)
                {
                    ViewBag.error = "La ruta de salida y llegada no existen";
                    RedirectToAction("Create");
                }
                else
                {
                    db.corridas.Add(corrida);
                    db.SaveChanges();
                    ViewBag.error = "";
                    return RedirectToAction("Index");
                }
            }

            ViewBag.itinerario = new SelectList(db.itineriarios, "id", "id", corrida.itinerario);
            return View(corrida);
        }
 public ActionResult Edit(corrida corrida)
 {
     if (ModelState.IsValid)
     {
         db.Entry(corrida).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.itinerario = new SelectList(db.itineriarios, "id", "id", corrida.itinerario);
     return View(corrida);
 }