I'm using the below code to fetch the state. I'm getting the error" Method 'System.String GetState(int32)' has no supported translation to SQL".Please let me know where i'm doing a mistake.
public IQueryable<ViewModel> GetResult()
{
IQueryable<ViewModel> result;
if (isDestinationSite)
{
result = (from table1 in this.db.tblTable1
select new ViewModel
{
State= this.GetState(table1.PersonUID),
});
}
private string GetState(int PersonUID)
{
using ( PersonPref pref = new PersonPref ())
{
pref .selectPref(ApplicationCode.MyApp, PersonPref .preference);
if (pref.PesronValue== "True")
{
return "Successfull";
}
else
{
return "Failure";
}
}
}