Get websitemodel in backoffice panel

I have a created a settings panel in Media, backoffice. I want to use the WebsiteModel from there.
In other places i can do something like “website = _requestModelAccessor.RequestModel.WebsiteModel” and then work with the values. But the RequestModel is null when i get here. Is there another way to get the WebSiteModel or can i get a populated RequestModel somehow?

RequestModel comes from the accelerator and isn’t available in the back office. BO is agnostic as to what website is used.

Could you simply get the website via WebsiteService? What is the settings panel for?

Yes i can get the website via WebsiteService. But i can’t understand why i can’t get values the same way. If the website comes from the RequestModel i can do like this :
var exampleValue = website.GetValue(AcceleratorWebsiteFieldNameConstants.ExampleValue);
But that doesn’t give me any value if the website comes from WebsiteService. What is the difference. I create a WebsiteModel and pass the Website as parameter, so it looks the same as a website from the RequestModel, but it doesn’t behave the same. What am i missing?

OK, i had to pass cultureInfo as parameter to get values from the WebsiteService website.

Yes, and keep in mind that for the BO CultureInfo.CurrentCulture is what the user has selected as their editing language and CultureInfo.CurrentUiCulture is what they’ve selected as their interface language. Whereas for the public site these are connected to the settings on the channel.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.