Paul W
Paul W

Reputation: 114

Getting content from umbraco to mvc backend

My client wants to be able to enter things into the admin section of umbraco and add things into the editor. From there how can I pull that data from the mvc backend? I am able to find the node, it's parent, etc, but cannot find the text he wrote in the tinymce editor. What is the best way to get that text? Thank you for

Upvotes: 0

Views: 153

Answers (1)

Oleksandr Skrypnyk
Oleksandr Skrypnyk

Reputation: 394

There are two ways of getting data in Umbraco now:

1) ContentService - get IContent object from database

2) Umbraco.TypedContent - get IPublishedContent object from XML cache

In your case the best way will be to use Content service object and get data from the database, I would do it like that:

var content = ApplicationContext.Services.ContentService.GetById(1234);
var propertyValue = content.GetValue<Type>("propertyAlias");

Don't use IPublishedContent at backend because you have to use actual data from the database for working in controllers.

Upvotes: 1

Related Questions