private void dgvProfessores_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4) { Model.ProfessorResponse model = dgvProfessores.CurrentRow.DataBoundItem as Model.ProfessorResponse; frmProfessorCadastrar tela = new frmProfessorCadastrar(); tela.CarregarCampos(model); frmInicial.Current.OpenScreen(tela); Hide(); } if (e.ColumnIndex == 5) { Model.ProfessorResponse model = dgvProfessores.CurrentRow.DataBoundItem as Model.ProfessorResponse; DialogResult r = MessageBox.Show("Deseja excluir", "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (r == DialogResult.Yes) { API.Client.ProfessorApi api = new API.Client.ProfessorApi(); api.Deletar(model.IdProfessor); MessageBox.Show("Removido com Sucesso"); CarregarGrid(); } } }
private void Alterar() { ProfessorResponse professor = dgvProfessores.CurrentRow.DataBoundItem as ProfessorResponse; frmProfessorCadastrar tela = new frmProfessorCadastrar(); frmInicial.Current.OpenScreen(tela); tela.CarregarCampos(professor); this.Hide(); }