private void tiposDeVehículosToolStripMenuItem_Click(object sender, EventArgs e) { frmCarTypes frmCarTypes = new frmCarTypes(); frmCarTypes.Show(); Hide(); }
private void btnSave_Click(object sender, System.EventArgs e) { if (IsValid()) { CarType carType = rentACarEntities.CarTypes.Where(ct => ct.Id == CarType.Id).FirstOrDefault(); carType.Description = txtDescription.Text; rentACarEntities.Entry(carType).State = System.Data.Entity.EntityState.Modified; rentACarEntities.SaveChanges(); MessageBox.Show("El tipo de vehiculo fue editado correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCarTypes frmCarTypes = new frmCarTypes(); frmCarTypes.Show(); Hide(); } }
private void btnSave_Click(object sender, EventArgs e) { if (IsValid()) { rentACarEntities.CarTypes.Add(new CarType() { Description = txtDescription.Text, Status = true, Created = DateTime.Now }); rentACarEntities.SaveChanges(); MessageBox.Show("El tipo de vehiculo fue agreagdo correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCarTypes frmCarTypes = new frmCarTypes(); frmCarTypes.Show(); Close(); } }