public ActionResult Index(int?id = null) { var availableLanguages = _localizationService.GetAllLanguages(); if (id.HasValue) { var content = _umbracoContextAccessor.UmbracoContext.Content.GetById(true, id.Value); if (content is null) { return(HttpNotFound()); } availableLanguages = availableLanguages.Where(language => content.Cultures.ContainsKey(language.IsoCode)); } var model = new BackOfficePreviewModel(_features, _globalSettings, availableLanguages, _iconService); if (model.PreviewExtendedHeaderView.IsNullOrWhiteSpace() == false) { var viewEngineResult = ViewEngines.Engines.FindPartialView(ControllerContext, model.PreviewExtendedHeaderView); if (viewEngineResult.View == null) { throw new InvalidOperationException("Could not find the view " + model.PreviewExtendedHeaderView + ", the following locations were searched: " + Environment.NewLine + string.Join(Environment.NewLine, viewEngineResult.SearchedLocations)); } } return(View(_globalSettings.Path.EnsureEndsWith('/') + "Views/Preview/" + "Index.cshtml", model)); }
public ActionResult Index() { var model = new BackOfficePreviewModel(_features, _globalSettings); if (model.PreviewExtendedHeaderView.IsNullOrWhiteSpace() == false) { var viewEngineResult = ViewEngines.Engines.FindPartialView(ControllerContext, model.PreviewExtendedHeaderView); if (viewEngineResult.View == null) { throw new InvalidOperationException("Could not find the view " + model.PreviewExtendedHeaderView + ", the following locations were searched: " + Environment.NewLine + string.Join(Environment.NewLine, viewEngineResult.SearchedLocations)); } } return(View(_globalSettings.Path.EnsureEndsWith('/') + "Views/Preview/" + "Index.cshtml", model)); }