private void button1_Click(object sender, EventArgs e) { Subject s = new Subject(); if (updateMode == true) { s.Name = tbName.Text; s.ID = selectedSubject.ID; controller.UpdateSubject(s); } else { controller.AddSubject(tbName.Text); } this.Close(); }