1
votes

I'm creating a custom Widget to expose a WebAPI based search that is co-hosted with the Orchard instance. The UI is a simple search box, that uses AJAX to call through a controller in the widget which proxies the async comms with the WebAPI back end. That then populates a partial view once the search has finished.

What I'm struggling with is how to let the controller access ContentPart data from the widget. I have the part ID, but I don't understand how best to look up the ContentPart from it.

I haven't found any examples that work like this, most widgets that get third party data don't take user input for the look up. Have I missed one that does?

1

1 Answers

0
votes

Inject a IContentManager and use it to Get the content item with the ID you have. Then .As<TypeOfThePart>() and do what you need to do.