Trying to get data from service and bind it to grid
I'm getting the data in localitem and the error occurs on the "foreach" line
any help would be appreciated
private IEnumerable<PersonalIDCheckerMvCKendo.Models.PersonInfo> Getlocalinfo(string personalNO)
{
needsUpdate = false;
using (PersonalInfoServiceClient serviceclient = new PersonalInfoServiceClient())
{
List<PersonalIDCheckerMvCKendo.Models.PersonInfo> personInfo = new List<PersonalIDCheckerMvCKendo.Models.PersonInfo>();
try
{
IEnumerable localItem = serviceclient.GetLocalInfoForPerson(personalNO);
if (localItem != null)
{
foreach (PersonalIDCheckerMvCKendo.Models.PersonInfo dalitem in localItem)
{
personInfo.Add(new PersonalIDCheckerMvCKendo.Models.PersonInfo
{
DocumentSerie = dalitem.DocumentSerie,
DocumentNumber = dalitem.DocumentNumber,
DocumentType = dalitem.DocumentType,
DocumentIssuer = dalitem.DocumentIssuer,
DocumentValidDate = dalitem.DocumentValidDate
});
}
}
return personInfo.ToArray();
}
catch
{
throw;
}
finally
{
serviceclient.Close();
}
}
}
EDIT:
GetLocalInfoForPerson is of type PersonalInformation
public partial class PersonalInformation : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged , System.Collections.IEnumerable