private void BtnExcluir_Click(object sender, EventArgs e)
        {
            if (GridCarros.Rows.Count == 0)
            {
                return;
            }

            int id = Convert.ToInt32(GridCarros.SelectedRows[0].Cells[ColumnId.Index].Value);

            var resultado = MessageBox.Show(this, "Deseja realmente excluir o carro " + id + " ?", "LTPV", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (resultado == DialogResult.No)
            {
                return;
            }

            ICarroService service = Program.container.GetInstance <ICarroService>();

            if (service.Excluir(id))
            {
                PreencherGrid();
                MessageBox.Show(this, "Carro excluído com sucesso.", "LTPV", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
 public void Excluir(CarroDTO entidade)
 {
     _servico.Excluir(Util.CastDTO.castCarroDTOParaEntidade(entidade));
 }