I am getting the following error on the following procedure
public Patient getPatientByPatientId(int PatientID)
{
Patient patient = new Patient();
if (PatientID == -1)
{
patient = new Patient();
}
else
{
using (var myContext = new SMBASchedulerEntities(this.Connectionstring))
{
patient = myContext.Patients
.Where(w => w.PatientID == Convert.ToString(PatientID)).FirstOrDefault();
}
}
return patient;
}
The error is
n unhandled exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll
Additional information: LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression.