public ActionResult DeleteConfirmed(string id)
        {
            Repartidores repartidores = db.Repartidores.Find(id);

            db.Repartidores.Remove(repartidores);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Cod_Repartidores,CI,Telefono_Repartidor,Nombre_Repartidor,Placa")] Repartidores repartidores)
 {
     if (ModelState.IsValid)
     {
         db.Entry(repartidores).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(repartidores));
 }
        public ActionResult Create([Bind(Include = "Cod_Repartidores,CI,Telefono_Repartidor,Nombre_Repartidor,Placa")] Repartidores repartidores)
        {
            if (ModelState.IsValid)
            {
                db.Repartidores.Add(repartidores);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(repartidores));
        }
        // GET: Repartidores/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Repartidores repartidores = db.Repartidores.Find(id);

            if (repartidores == null)
            {
                return(HttpNotFound());
            }
            return(View(repartidores));
        }
        public ActionResult Edit(string id, Repartidores repartidor)
        {
            try
            {
                using (DbModels dbModel = new DbModels())
                {
                    dbModel.Entry(repartidor).State = EntityState.Modified;
                    dbModel.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(Repartidores repartidor)
        {
            try
            {
                using (DbModels dbModels = new DbModels())
                {
                    dbModels.Repartidores.Add(repartidor);
                    dbModels.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Delete(string id, FormCollection collection)
        {
            try
            {
                using (DbModels dbModel = new DbModels())
                {
                    Repartidores repartidor = dbModel.Repartidores.Where(x => x.Cod_Repartidor == id).FirstOrDefault();
                    dbModel.Repartidores.Remove(repartidor);
                    dbModel.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }