Goal: load 2sxc content-blocks on demand in a single page application. If we could get the data that powers the content blocks, rather than markup, that'd be fine too.
Here's the first naive go at responding with markup from a webapi endpoint:
[HttpGet]
[DnnModuleAuthorize(AccessLevel = SecurityAccessLevel.Anonymous)]
[ValidateAntiForgeryToken]
public dynamic CityDetails(string id)
{
return from city in AsDynamic(App.Data["City"])
where city.Name == id
select new {
Name = city.Name,
Details = city.Details.Aggregate("", (markup, contentBlock) =>
markup += contentBlock.Render())
};
}
Pointers would be appreciated!