我在将linq lambda表达式的结果显示到视图时遇到问题。
这是我的代码:
var idSearchJoin = payoutdb.payout_transaction // your starting point - table in the "from" statement
.Join(payoutdb.payout_remittance, // the source table of the inner join
transaction => transaction.transid, // Select the primary key (the first part of the "on" clause in an sql "join" statement)
remit => remit.transid, // Select the foreign key (the second part of the "on" clause)
(transaction, remit) => new { Transaction = transaction, Remit = remit }) // selection
.Where(transactremit => transactremit.Transaction.senderRefId == searchTxt);
这个问题由于我在这里使用的联接而变得复杂,所以现在我不知道如何像不使用联接那样将数据传输到视图。
答案 0 :(得分:1)
var idSearchJoin = payoutdb.payout_transaction.Include(x => x.payout_remittance).Where(x => x.payout_remittance.Any(y => y.senderRefId == searchTxt));
试试这个。