Beispiel #1
0
        private void modelosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmModels frmModels = new frmModels();

            frmModels.Show();
            Hide();
        }
Beispiel #2
0
 private void btnSave_Click(object sender, System.EventArgs e)
 {
     if (IsValid())
     {
         Model             = rentACarEntities.Models.Where(m => m.Id == Model.Id).FirstOrDefault();
         Model.Description = txtDescription.Text;
         Model.MakeId      = (int)cbMake.SelectedValue;
         rentACarEntities.Entry(Model).State = EntityState.Modified;
         rentACarEntities.SaveChanges();
         MessageBox.Show("El modelo fue editado correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
         frmModels frmModels = new frmModels();
         frmModels.Show();
         Hide();
     }
 }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                rentACarEntities.Models.Add(new Model()
                {
                    Description = txtDescription.Text,
                    MakeId      = (int)cbMake.SelectedValue,
                    Status      = true,
                    Created     = DateTime.Now
                });

                rentACarEntities.SaveChanges();

                MessageBox.Show("El modelo fue agreagdo correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmModels frmModels = new frmModels();
                frmModels.Show();
                Close();
            }
        }