コード例 #1
0
        private void tiposDeCombustiblesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmFuelTypes frmFuelTypes = new frmFuelTypes();

            frmFuelTypes.Show();
            Hide();
        }
コード例 #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsValid())
     {
         FuelType fuelType = rentACarEntities.FuelTypes.Where(ft => ft.Id == FuelType.Id).FirstOrDefault();
         fuelType.Description = txtDescription.Text;
         rentACarEntities.Entry(fuelType).State = System.Data.Entity.EntityState.Modified;
         rentACarEntities.SaveChanges();
         MessageBox.Show("El tipo de combustible fue editado correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
         frmFuelTypes frmFuelTypes = new frmFuelTypes();
         frmFuelTypes.Show();
         Hide();
     }
 }
コード例 #3
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (IsValid())
            {
                rentACarEntities.FuelTypes.Add(new FuelType()
                {
                    Description = txtDescription.Text,
                    Status      = true,
                    Created     = DateTime.Now
                });

                rentACarEntities.SaveChanges();

                MessageBox.Show("El tipo de combustible fue agregado correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmFuelTypes frmFuelTypes = new frmFuelTypes();
                frmFuelTypes.Show();
                Close();
            }
        }