private void CadastroClubesForm_Load(object sender, EventArgs e) { using (var bo = new FormacaoTaticaBO()) { cbxFormacoes.DataSource = bo.List(); var formacao = bo.List(); if (_clube != null) { txtId.Text = _clube.Id.ToString(); txtNome.Text = _clube.Nome; txtSigla.Text = _clube.Sigla; cbxFormacoes.SelectedIndex = formacao.IndexOf(formacao.FirstOrDefault(x => x.Id == _clube.FormacaoTatica_Id)); txtImagemId.Text = _clube.Escudo_Id.ToString(); pcbEscudo.Image = ImagemBO.ByteToImage(_clube.Escudo?.bytes); menuRemover.Visible = true; AtualizarGrid(); } else { menuRemover.Visible = false; } } }
public void AtualizarGrid() { using (var bo = new FormacaoTaticaBO()) { dgvFomacoes.AutoGenerateColumns = false; bsFormacoes.DataSource = bo.List(); } }
public SelectList PreencherFormacoesTaticas() { using (var bo = new FormacaoTaticaBO()) { var formacoes = bo.List(); return(formacoes.Select(x => new SelectListItem { Text = x.Descricao, Value = x.Id.ToString() }).ToSelectList()); } }