public void Carregar(string descricao) { IList<Proposta> _propostas = null; using (var _context = new DBPropostasContext(App.connectionString)) { try { IQueryable<Proposta> _query = _context.Proposta; _propostas = _query.Where(p => p.DescProduto.ToUpper().StartsWith(descricao.ToUpper())).ToList(); this.ItensProposta.Clear(); foreach (var item in _propostas) { this.ItensProposta.Add(item); } } catch (Exception ce) { Console.WriteLine(ce.Message); _propostas = null; } } }
public void Carregar() { IList<Proposta> _propostas = null; using (var _context = new DBPropostasContext(App.connectionString)) { try { IQueryable<Proposta> _query = _context.Proposta; _propostas = _query.ToList(); this.ItensProposta.Clear(); foreach (var item in _propostas) { this.ItensProposta.Add(item); } } catch(Exception ce) { Console.WriteLine(ce.Message); _propostas = null; } } }