Hello,
I have some problem with my code
public IQueryable<PageItems> GetPageById(Guid Id)
{
var xml = Utility.LoadXmlFile("Pages/" + Id);
var q = (from f in xml.Descendants("Page")
where (Guid)f.Element("id") == Id
select new PageItems
{
Title = f.Element("Title").Value,
Content = f.Element("Content").Value,
PublishDate = f.Element("PublishDate").Value,
}).AsQueryable();
return q;
}
I get this error:
Value cannot be null.
Parameter name: element
Line 63: where (Guid)f.Element("id") == Id
The xml file:
<Page id="235487c9-f706-4550-831e-cc504e99d3c5">
<Title>Test</Title>
<Content>Test</Content>
<PublishDate>Test</PublishDate>
<Url>about/contact</Url>
</Page>