This project is read-only.

Access page fields and parts via webAPI.

Topics: Customizing Orchard
Feb 4, 2015 at 6:22 PM
Edited Feb 4, 2015 at 6:24 PM
I want to all the elements in a page given a passed in id to the API get method
I have this which uses a partRecord and IOrchardServices.

public BuyerSearchViewModel Get(string id)
DefaultTemplatePart serviceSearch = _services.ContentManager.Query<DefaultTemplatePart, DefaultTemplatePartRecord>().Where(x => x.Name == id).List().FirstOrDefault();
            var bodyPart = serviceSearch.As<BodyPart>();
            if (serviceSearch != null) {
                var buyerSearchModel = new BuyerSearchViewModel {
                    Id = 123456,
                    Body = bodyPart.Text,
                    Title = serviceSearch.Title
                return buyerSearchModel;
            return null;

.... but how would I query if I hadn't made a part record and just wanted to get at the fields and parts on a contentitem page created in the dashboard?