public List <Patrimonio> Get() { List <Patrimonio> patrimonios = new List <Patrimonio>(); SqlCommand query = new SqlCommand(); connection.Open(); query.Connection = connection; query.CommandText = @"SELECT * FROM Patrimonio ORDER BY Nome ASC"; SqlDataReader leitura = query.ExecuteReader(); while (leitura.Read()) { Patrimonio patrimonio = new Patrimonio(); patrimonio.MarcaId = (int)leitura["MarcaId"]; patrimonio.Nome = (string)leitura["Nome"]; patrimonio.Descricao = (string)leitura["Descricao"]; patrimonio.NumeroTombo = (int)leitura["NumeroTombo"]; patrimonios.Add(patrimonio); } return(patrimonios); }