I'm getting pretty desperate here since this code was working before I had some unfortunate git issues and had to wipe out my project and checkout again. For some reason my IQueryable objects are not allowing me to reference properties anymore. In my code below, evt.id should be a valid but id is not recognized as a property of evt in Visual Studio. Also, I should mention that I can't access not only evt but also can't access any properties that belong to goal. Anything I missed when recoding this portion of my controller?
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);
}
Any help would be greatly appreciated.
get evt obj this way,
var evt = db.patient_event.Where(e => (e.patient_id == id) && (e.date == DateTime.Today)).FirstOrDefault();