Hi guys,
I'm using this code, from the nerddinner example. This method will display a list of all the upcoming dinners in a database when called in the controller.
public IQueryable<Dinner> FindUpcomingDinners()
{
return from dinner in entities.Dinners
where dinner.EventDate > DateTime.Now
orderby dinner.EventDate
select dinner;
}
I would have thought that this:
public IQueryable<Dinner> FindUpcomingDinners()
{
return from dinner in entities.Dinners
where dinner.EventDate > DateTime.Now && dinner.HostedBy == User.Identity.Name
orderby dinner.EventDate
select dinner;
}
would give me just the dinners that are hosted by the currently logged on user, however I get three errors:
Delegate 'System.Func' does not take 1 arguments
Cannot convert lambda expression to type 'string' because it is not a delegate type
The name 'User' does not exist in the current context
Any pointers in the right direction would be appreciated :)
the current context