I have two entities ( TipoDeRequerimento
and TipoRequerimentoSituaçãoAcademica
) in my query. Today I can make a filter to bring the Types of requirements that have a certain academic situation pre-registered. Now I need this filter to also return the Application Types that do not have an Academic Status informed, that is, for a given application that I have registered and did not report Academic Status.
Follow the query code:
IList lista = null;
using (var bll = new TipoRequerimentoRepository(empresa))
{
var pLista = bll.Query(p => p.Descricao.Contains(filtro) || filtro == "")
.Where(p => categoriaID == 0 || p.CategoriaID == categoriaID)
.Where(p => situacaoAcademicaID == 0 || p.TipoRequerimentoSituacaoAcademica.Any(x => x.AlunoSituacaoAcademica.AlunoSituacaoAcademicaID == situacaoAcademicaID))
.Where(p => p.Ativo == true)
.Select(p => new
{
id = p.ID,
name = p.Descricao,
prazoDias = p.Prazo,
valor = p.ValorUnitario,
Gratuito = p.Gratuito
});
lista = pQtdeRegistros > 0 ? pLista.Take(pQtdeRegistros).AsNoTracking().Distinct().ToList() : pLista.AsNoTracking().ToList();
}
return lista;
In the filter I tried to put a code that filtered TipoRequerimentoStuacaoAcademica == NULL
but did not succeed. If anyone can help me, thank you very much.