I have three table A , B , C;
//Table A
public class Question
{
[Key]
public int ID { get; set; }
[Required]
public string Name { get; set; }
}
//Table B
public class Answer
{
[Key]
public int ID { get; set; }
[Required]
public string Name { get; set; }
[Required]
public int QusetionID { get; set; }
[Required]
public int LocalID { get; set; }
}
//Table C
public class Local
{
[Key]
public int ID { get; set; }
[Required]
public string Name { get; set; }
[Required]
public int Localip { get; set; }
}
What is the desired query Questions that are not answered by the Local How do you use except in the two matrices using ? With Entity Framework In Asp.net MVC I want to show a list of questions that are not answered?
string ip = Request.UserHostAddress;
var answerip = db.Answer.Where(l => l.Local.Localip == ip );
var quslist = db.Qustions.Except(answerip);
List<int> tempIdList = answeripE.Select(q => q.ID).ToList();
var quslist = db.Qustion.Where(q => !tempIdList.Contains(q.ID));
Thanks for the creator of "daryal" Get All Except from SQL database using Entity Framework