不幸な git の問題が発生する前にこのコードが機能していたので、ここでかなり絶望的になり、プロジェクトを一掃して再度チェックアウトする必要がありました。何らかの理由で、IQueryable オブジェクトでプロパティを参照できなくなりました。以下のコードでは、evt.id は有効である必要がありますが、id は Visual Studio で evt のプロパティとして認識されません。また、evt だけでなく、goal に属するプロパティにもアクセスできません。コントローラーのこの部分を再コーディングするときに見逃したものはありますか?
public HttpResponseMessage GetTodaysPatientGoals(int id)
{
var evt = db.patient_event.Where(e => (e.patient_id == id) && (e.date == DateTime.Today));
//evt.id is not recognized here either
if(evt != null)
{
//evt.id is not recognized as a property of evt here
//also cant access properties of goal either
var goal = db.patient_goals.Where(g => (g.patient_id == id) && (g.event_id == evt.id)).Select(row => (new { row.id, row.completed, row.goal }));
return Request.CreateResponse(HttpStatusCode.OK, goal);
}
return Request.CreateResponse(HttpStatusCode.NoContent);
}
どんな助けでも大歓迎です。