public ActionResult DeleteConfirmed(int id)
        {
            TIPOVEHICULO tIPOVEHICULO = db.TIPOVEHICULOes.Find(id);

            db.TIPOVEHICULOes.Remove(tIPOVEHICULO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "IDTIPOVEHICULO,DESCRIPCION")] TIPOVEHICULO tIPOVEHICULO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tIPOVEHICULO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tIPOVEHICULO));
 }
        public ActionResult Create([Bind(Include = "IDTIPOVEHICULO,DESCRIPCION")] TIPOVEHICULO tIPOVEHICULO)
        {
            if (ModelState.IsValid)
            {
                db.TIPOVEHICULOes.Add(tIPOVEHICULO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tIPOVEHICULO));
        }
        // GET: TIPOVEHICULOes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TIPOVEHICULO tIPOVEHICULO = db.TIPOVEHICULOes.Find(id);

            if (tIPOVEHICULO == null)
            {
                return(HttpNotFound());
            }
            return(View(tIPOVEHICULO));
        }
Пример #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Estás seguro que quieres eliminar el registro?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                tipovehiculo.IdTipoVehiculo = (int)dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value;

                using (RentCarEntities db = new RentCarEntities())
                {
                    tipovehiculo = db.TIPOVEHICULO.Where(x => x.IdTipoVehiculo == tipovehiculo.IdTipoVehiculo).FirstOrDefault();
                    db.TIPOVEHICULO.Remove(tipovehiculo);
                    db.SaveChanges();
                    Clear();
                    ReFill();
                    MessageBox.Show("Deleted Successfully!");
                }
            }
        }
Пример #6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                tipovehiculo.IdTipoVehiculo = (int)dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value;

                using (RentCarEntities db = new RentCarEntities())
                {
                    tipovehiculo        = db.TIPOVEHICULO.Where(x => x.IdTipoVehiculo == tipovehiculo.IdTipoVehiculo).FirstOrDefault();
                    txbDescripcion.Text = tipovehiculo.Despcricion;
                    cbEstado.Text       = tipovehiculo.Estado;
                }
                btnSave.Text = "Update";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }