public void CargarComercios() { using (var uow = UnitOfWorkProvider.BeginUnitOfWork()) { var comercios = ComercioRepository.GetAll(); gridComercios.DataSource = comercios.Select(x => new { x.Id, x.RazonSocial, x.CUIT, x.Direccion }).OrderBy(y => y.RazonSocial).ToList(); } }
private void LoadComboComercios() { var comercios = ComercioRepository.GetAll().OrderBy(x => x.RazonSocial) .Select(x => new ComboBoxItem { Text = x.RazonSocial, Value = x.Id }).ToList(); cboComercios.Items.Clear(); var list = new List <ComboBoxItem> { new ComboBoxItem { Text = "--- Seleccione un Comercio ---", Value = -1 } }; list.AddRange(comercios); cboComercios.DataSource = list; cboComercios.ValueMember = "Value"; cboComercios.DisplayMember = "Text"; }