I have the classes:
%pre%Given a %code% , I want to know how many %code% has %code% 2 and %code% 2.
Something like (I know this is not possible):
%pre%I have the classes:
%pre%Given a %code% , I want to know how many %code% has %code% 2 and %code% 2.
Something like (I know this is not possible):
%pre%I have the classes:
public class Modulo
{
[Key]
public int ModuloID { get; set; }
public int SatisfacaoID { get; set; }
public virtual Satisfacao Satisfacao { get; set; }
public virtual ICollection<AlunoSatisfacao> AlunoSatisfacoes { get; set; }
}
public class AlunoSatisfacao
{
public int AlunoSatisfacaoID { get; set; }
public DateTime Data { get; set; }
public int SatisfacaoID { get; set; }
public int AlunoID { get; set; }
public int ModuloID { get; set; }
public virtual Satisfacao Satisfacao { get; set; }
public virtual Aluno Aluno { get; set; }
public virtual Modulo Modulo { get; set; }
public virtual ICollection<AlunoSatisfacaoResposta> AlunoSatisfacaoRespostas { get; set; }
}
public class AlunoSatisfacaoResposta
{
[Key]
public int AlunoSatisfacaoRespostaID { get; set; }
public int AlunoSatisfacaoID { get; set; }
public int SatisfacaoPerguntaID { get; set; }
public string Resposta { get; set; }
public virtual AlunoSatisfacao AlunoSatisfacao { get; set; }
public virtual SatisfacaoPergunta SatisfacaoPergunta { get; set; }
}
Given a Modulo
, I want to know how many AlunoSatisfacaoResposta
has resposta
2 and SatisfacaoPerguntaID
2.
Something like (I know this is not possible):
var modulo = PegarModulo(5);
int countResposta = modulo.AlunoSatisfacao.Where(x=> x.AlunoSatisfacaoRespostas.Resposta = 2 && x.AlunoSatisfacaoRespostas.SatisfacaoPerguntaID = 2).Count();
int countResposta = modulo.AlunoSatisfacoes.Where(
x => x.AlunoSatisfacaoRespostas.Any(
y => y.Resposta == "2" && y.SatisfacaoPerguntaID == 2
)
).Count();