private void btnSave_Click(object sender, EventArgs e) { ProgamType _newProgType = new ProgamType(); if (IsEditMode == true) { _newProgType = _db.GetProgramTypeById(ProgramTypeId, databaseId); } _newProgType.ProgramTypesDescription = txtDescription.Text; _newProgType.Notes = txtNotes.Text; _newProgType.CustomerId = CustomerId; _newProgType.FosterCare = chkFosterCare.Checked; _newProgType.SubstanceAbuse = chkSubstanceAbuse.Checked; _newProgType.Residential = chkResidential.Checked; _newProgType.databaseID = databaseId; if (IsEditMode == true) { _db.SaveProgramTypes(_newProgType); _db.SaveChanges(); MessageBox.Show(this, "Program Types Saved", "Program Types has been updated ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { _db.AddToProgramType(_newProgType); _db.SaveChanges(); MessageBox.Show(this, "Program Types Saved", "Program Types has been Created ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }