我的代码是:
'GET:odata / Event_Game_Schedule
<EnableQuery>
Function GetEvent_Game_Schedule() As IQueryable(Of Event_Game_Schedule)
Dim schedule As New List(Of Event_Game_Schedule)
schedule = db.Event_Game_Schedule.ToList()
For Each x As Event_Game_Schedule In schedule
x.hometeamid = (From t In db.Teams Where t.id = x.hometeamid Select t.name).FirstOrDefault
x.visitorteamid = (From t In db.Teams Where t.id = x.visitorteamid Select t.name).FirstOrDefault
Next
Return schedule.AsQueryable.ToList()
End Function
我做错了什么..这是一个控制器,我想要返回团队的名称,而不是API中的teamid。
感谢
答案 0 :(得分:0)
我找到了我只需要添加ASQueryable部分的答案..而不是.ToList()
这是vb.net项目的visual Basic