Hi can anybody help with this I am getting the above error when trying to display data about the Carmodels in my view
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int CarId { get; set; }
[Required]
public string Registration { get; set; }
[Required]
public virtual CarModels Model { get; set; }
[Required]
public string RegistrationYear { get; set; }
[Required]
public string ChassisNumber { get; set; }
[Required]
public int RegistrationId { get; set; }
And here is the function
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();
}