1
I have a query that returns only the catechisms that went to the event:
var catequizandosCheked = (from cat in db.Catequizando
where cat.Eventos.Any(e => e.EventoID == eventoID)
select new PresencaEventoViewModel
{
CatequizandoID = cat.CatequizandoID
}).ToList();
and I have another query that returns all the catechized:
var catequizandos = (from i in db.Inscricao
join c in db.Catequizando on i.CatequizandoID equals c.CatequizandoID
join p in db.Pessoa on c.CatequizandoID equals p.PessoaID
join g in db.Grupo on i.GrupoID equals g.GrupoID
where queryAnoPastoral.Contains(i.AnoPastoral)
select new PresencaEventoViewModel
{
Nome = p.Nome,
CatequizandoID = p.PessoaID,
AnoCatequese = i.AnoCatequese,
LetraGrupo = g.LetraGrupo,
Estado = !catequizandosCheked.Contains(p.PessoaID) ? "unchecked" : (catequizandosCheked.Contains(p.PessoaID) ? "checked" : null )
});
In the query catequizandos
I intend to return the attribute Estado
"cheked" or "Uncheked" if found or not, the value of the query catequizandos
What’s the matter? Any of the darlings is not working? The attribute
Estado
is not returning right?– Daniel Dutra
The state attribute is not being returned.
– WickedOne
Have you tried debug his line and see if it’s not always falling in the second Else and receiving null?
Estado = !catequizandosCheked.Contains(p.PessoaID) ? "unchecked" : (catequizandosCheked.Contains(p.PessoaID) ? "checked" : null
– Daniel Dutra