impossible to convert lambda into string because not delegate
Hello,
I'm currently working on the 7.6.5 version of Umbraco and I wanna make a list of Question/Answer set.
I've got tha lambda expression, trying lead to "sectionGeneric" DocumentTypeAlias... But I've got this error :
"impossible to convert lambda into string because not delegate"
public ActionResult RenderFaqList()
{
try
{
List<FaqModel> model = new List<FaqModel>();
IPublishedContent section = CurrentPage.AncestorOrSelf(1).DescendantsOrSelf().Where(x => x.DocumentTypeAlias == "sectionGeneric").FirstOrDefault();
foreach (IPublishedContent page in section.Children)
{
model.Add(new FaqModel(page.GetPropertyValue<string>("question"), page.GetPropertyValue<string>("answer")));
}
}
catch (NullReferenceException ex)
{
Console.WriteLine("Erreur de référence nulle : " + ex);
}
return PartialView(PARTIAL_VIEW_FOLDER + "_FAQ.cshtml");
}
impossible to convert lambda into string because not delegate
Hello,
I'm currently working on the 7.6.5 version of Umbraco and I wanna make a list of Question/Answer set.
I've got tha lambda expression, trying lead to "sectionGeneric" DocumentTypeAlias... But I've got this error : "impossible to convert lambda into string because not delegate"
Any clues ?!?
Hi Natalie
Can you show "FaqModel" constructor? Maybe the issue is there, the code you showed looks fine.
Thanks,
Alex
Hello Alex !
Sorry for that late replie, I was passing exams. So here is my FaqModel :
Thank you...
Natalie, please, check that you have a reference to "using System.Linq;" namespace.
Yes I do have it..... But it is noticed that the reference is not necessary...
Actually I add it int the controller and I don't have the error anymore...
Thanks a million Alex !!! :)
is working on a reply...