Umbraco Surface Controller migrate from V7 to V12

88 views Asked by At

I'm trying to refator the Umbraco Surfrace Controller what was written on V7 to get working on V12. The problem is that i didn't find a way to access "IPublishedContent" and also is there a way to access "CultureDictionary"? This was written a long time ago, is there a new way what is used to achive that result?(Please see the attached picture). This controller is called by Javascript. Should i have to use other type controller?

old controller

Looked the documentation, but i'm getting confused about these Surface controllers.

UPDATE: I'm able to get CurrentPage property with correct data, but only if i invoke the Surface Controller by "Html.BeginUmbracoForm", still didn't find a way to call it correctly with ajax.

1

There are 1 answers

0
furybg On

I think the problem is solved. Instead of using the CurrentPage property, I used this:

UmbracoContext.Content.GetAtRoot().FirstOrDefault()

This way, I'm able to get my root node and find what what is needed. If someone with more experience can confirm this workaround is okay, I will accept this answer.