I have following code which get all data using EF and then try converting them to Model as below.
var patients = allpatients.Select(p => CreatePatient(p));
public Patient CreatePatient(PATIENT p)
{
Patient patient = new Patient();
patient.FIRSTNAME = p.FIRSTNAME;
patient.MIDDLENAME = p.MIDDLENAME;
patient.SURNAME = p.SURNAME;
return patient;
}
But getting this error
"LINQ to Entities does not recognize the method 'Model.Patient CreatePatient(Repository.PATIENT)' method, and this method cannot be translated into a store expression."