, ToList(). ToList() using
public static List<Cars> GetRegistrationCars(int registration)
{
List<Cars> registrationCars = new List<Cars>();
using (var db = new EventsContext())
{
registrationCars = db.Cars.Where(c => c.RegistrationId == registration).ToList();
return registrationCars.ToList();
}
}
Edit:
It is assumed that the call ToListin the linq request is actually missing (I did not notice this first round), but now I hope this is a typo :)
source
share