public int Update(Pengurus pengurus) { int result = 0; if (string.IsNullOrEmpty(pengurus.Kode_Pengurus)) { MessageBox.Show("Kode Pengurus harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } if (string.IsNullOrEmpty(pengurus.Nama)) { MessageBox.Show("Nama harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } if (pengurus.No_Telepon == null) { MessageBox.Show("No Telepon harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } if (string.IsNullOrEmpty(pengurus.Username)) { MessageBox.Show("Username harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } if (string.IsNullOrEmpty(pengurus.Password)) { MessageBox.Show("Password harus diisi !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(0); } using (DbContext context = new DbContext()) { _repository = new PengurusRepository(context); result = _repository.Update(pengurus); } if (result > 0) { MessageBox.Show("Data pengurus berhasil diupdate !", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Data pengurus gagal diupdate !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(result); }