private void btnCancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; context.Dispose(); userIdentity.Dispose(); this.Close(); }
private void frmNewUser_Load(object sender, EventArgs e) { lstRoles = context.Roles.Select(r => r.Name)?.ToList(); if (lstRoles != null) { cmbRole.Properties.Items.AddRange(lstRoles); cmbRole.Text = lstRoles[0]; } else { XtraMessageBox.Show("There are no role in database", "Error"); context.Dispose(); userIdentity.Dispose(); this.Close(); } }