- Wed Sep 19, 2018 1:53 pm
#31997
Following the asp.net zero documentation step by step guide I have an issue getting the following code snippet to work
I've added this line of code to the CustomDtoMapper.cs
I get the error message when I try to use the GetPeople method.: "System.InvalidCastException: 'Specified cast is not valid.'" and I don't know how to resolve the issue. Any help would be much appreciated.
Code: Select all
public ListResultDto<PersonListDto> GetPeople(GetPeopleInput input)
{
var allPersons = _personRepository
.GetAll()
.Include(p => p.Phones)
.OrderBy(p => p.Name)
.ThenBy(p => p.Surname)
.ToList();
return new ListResultDto<PersonListDto>(ObjectMapper.Map<List<PersonListDto>>(allPersons));
}
I've added this line of code to the CustomDtoMapper.cs
Code: Select all
//Phone
configuration.CreateMap<Phone, PhoneInPersonListDto>();
I get the error message when I try to use the GetPeople method.: "System.InvalidCastException: 'Specified cast is not valid.'" and I don't know how to resolve the issue. Any help would be much appreciated.