0
這工作:傳遞EF查詢,查看
var model =
(from t in _db.Tickets
from p in _db.Cust
where t.Id == 5 && t.Id == p.cust_id
orderby t.Id descending
select new tks_custs
{
Tks = t,
Custs = p
});
但我想實現這樣通過使用組:
var model = _db.Tickets
.Join(_db.Cust,
t => t.Id,
w => w.cust_id,
(t, w) => new { Tks = t, Custs = w })
.Where(t => t.Tks.Id == 5).OrderByDescending(w => w.Tks.Id)
.GroupBy(t => t.Tks.Name).ToList();
我認爲聲明是目前:
@model IQueryable<test.ViewModels.tks_custs>
錯誤是。視圖接受iqueryable,但數據庫查詢通過 –
Pass ViewModel not Model .... – yash