簡體   English   中英

如何使用ASP.Net MVC通過“加入視圖”顯示LINQ lamda表達式結果?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM