private async void SaveButton_Click(object sender, EventArgs e) { if (AssigmentNameTextBox.Text == "") { MessageBox.Show("Subject code is empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DateTime time = AssigmentEndDate.Value.Date + AssigmentEndTime.Value.TimeOfDay; await SqlCommands.AddAssigmentAsync(AssigmentNameTextBox.Text, AssigmentStateList.Text, Subjects[SubjectPicker.SelectedIndex].Id, time); Close(); } }