public void SaveAdministratorExecute() { if (String.IsNullOrEmpty(ClinicAdministrator.NameAndSurname) || String.IsNullOrEmpty(ClinicAdministrator.IdentityCardNumber) || String.IsNullOrEmpty(ClinicAdministrator.DateOfBirth.ToString()) || String.IsNullOrEmpty(ClinicAdministrator.Gender) || String.IsNullOrEmpty(ClinicAdministrator.Citizenship) || String.IsNullOrEmpty(ClinicAdministrator.Username) || String.IsNullOrEmpty(ClinicAdministrator.Password)) { MessageBox.Show("Please fill all fields.", "Notification"); } else { try { MessageBoxResult result = MessageBox.Show("Are you sure you want to save the administrator?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { bool isCreated = administrators.CreateAdministrator(ClinicAdministrator); if (isCreated) { MessageBox.Show("Administrator is created.", "Notification", MessageBoxButton.OK); administratorView.Close(); } else { MessageBox.Show("Administrator cannot be created.", "Notification", MessageBoxButton.OK); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }