//Run when "Update" button is clicked. Saves the edited data to the database via UserAccountController. private void btnUpdate_Click(object sender, EventArgs e) { decimal accNo = Convert.ToDecimal(txtAccNumber.Text); var acc = accController.Get(accNo).First(); acc.AccountNo = Convert.ToInt32(txtAccNumber.Text); acc.Name = txtName.Text; acc.Dob = dateTimePicker1.Value.ToString(); acc.MotherName = null; acc.FatherName = null; acc.PhoneNo = txtBoxPhone.Text; if (rButtonMale1.Checked == true) { acc.Gender = "male"; } else { if (rButtonFemale1.Checked == true) { acc.Gender = "female"; } } if (rbtnMarried1.Checked == true) { acc.MaritialStatus = "Married"; } else { if (rbtnUnmarried1.Checked == true) { acc.MaritialStatus = "Unmarried"; } } acc.Address = txtBoxAddress.Text; acc.Oblast = txtBoxOblast.Text; acc.State = txtBoxCity.Text; accController.Update(acc); MessageBox.Show("Данните са обновени!"); dataGridView1.Update(); }