我有一个工作正常的方法。我试图添加一些修改查询,我无法通过。
public List<ProductDetails> getQuestionsNotRelatedWithProduct(int iProductID, int iSpaceID)
{
var oQuest = (from s in db.Questionaires
join t in db._Product_UserQuestionaires
on s.Questionaire_ID equals t.Questionaire_ID
where !(from n in db.Product_UserQuestionaires
join u in db.Products
on n.Product_ID equals u._Product_ID
where (u.Space_Type_ID == iSpaceID && u.Product_ID == iProductID)
select n.Questionaire_ID).Contains(s.Questionaire_ID)
select new ProductDetails
{
Question = s.Questionaire.ToString(),
QuestionID = s.Questionaire_ID,
}).Distinct();
return oQuest.ToList();
}
我想要像
一样public List<ProductDetails> getQuestionsNotRelatedWithProduct(int iProductID, int iSpaceID, IList questid)
{
//here i want to filter out/exclude the "IList questid" items from the query result
not getting how to do.
}
任何人都可以帮助我
由于
答案 0 :(得分:1)
只需将原始方法中的return语句修改为类似
return oQuest.Where(i => !questid.Contains(i.QuestionID)).ToList();