[英]How to display Linq to Entity query result in ASP.NET MVC view
[英]How to display LINQ lamda expression result with Join to a View using ASP.Net MVC?
我在将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);
我在这里使用的联接使这个问题变得复杂,所以现在我不知道如何像不使用联接那样将数据传输到视图。
var idSearchJoin = payoutdb.payout_transaction.Include(x => x.payout_remittance).Where(x => x.payout_remittance.Any(y => y.senderRefId == searchTxt));
尝试这个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.