0
我堅持如何最好地呈現一些從兩個不同的表中動態生成的數據。綁定透視查詢在ASP.Net中查看MVC
鑑於我的查詢:
var assets = assetRepo.Find(x => x.LoginId == User.Identity.Name);
var accounts = repository.Find(x => x.AccStatus == "A" && x.LoginId == User.Identity.Name);
var query = from asst in assets
join acct in accounts on asst.AccountId equals acct.AccountId
select new
{
Account = acct.AccountNumber,
Status = acct.AccStatus,
Make = asst.Make,
Model = asst.Model,
Submodel = asst.SubModel,
Registration = asst.Registration,
Balance = acct.BalanceOutstanding,
NextPayment = acct.NextPayment,
Date = String.Format("{0:dd MMM yyyy}", acct.NextPaymentDate),
Due = acct.ArrearsBal
};
什麼是最好的(即最乾淨)綁定這看法呢?是否需要一個自定義類或者是否有方法來指定和迭代一組匿名類型?