We try to get a page to redirect to from a panel that are created in aspx. And we can’t use the same function as we use for other pages. We got null when we tries to do the last step, .MapTo().
we use this one:
var pageTemplate = _fieldTemplateService.Get<PageFieldTemplate>(pageTemplateName);
using (var query = IoC.Resolve<DataService>().CreateQuery<Page>())
{
query.Filter(f => f
.TemplateSystemId("eq", pageTemplate.SystemId))
.ToList()
.ToLookup(x => x.WebsiteSystemId);
return query.Count() > 0 ? query.FirstOrDefault().MapTo<PageModel>() : null;
}