2
Good morning, everyone. my question is this, I have the following method in my model:
public IQueryable GetConsulta()
{
var q = (from c in Datacontext.Tabela1
join b in Datacontext.Tabela2 on c.CodClase equals b.CodClase
join d in Datacontext.Tabela3 on b.CodImobilizado equals d.CodImobilizado
where c.CodClase == b.CodClase && b.CodImobilizado == d.CodImobilizado
select new
{
taxa = c.Taxa,
ano = DateTime.Parse(b.Data).Year,
data = d.Data,
valorAquisicao = b.Valor,
});
return q;
}
In View it’s like this:
void getConsulta(){
var a = model.GetConsulta();
foreach(var linha in a){
//faça algo
}
}
The problem is that I cannot access the variables created in the model method in the View foreach.
Could someone help me.
You’re returning this to the View?
– Marconi
yes Marconi. i need to access the result of the select made in the model, within the foreach cycle that appears in the getquery method that is found in Viewer
– Dacassussua
And the answer below, I think it helps you. :)
– Marconi