Esempio n. 1
0
        private ActionResult ViewResult(LoadEmbeddedContentRequest data, string viewPath)
        {
            if (!string.IsNullOrEmpty(data.Culture))
            {
                System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo(data.Culture);
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(data.Culture);
            }

            if (string.IsNullOrWhiteSpace(data.Guid))
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(data.ContentTypeAlias))
            {
                return(null);
            }

            if (data.DataJson == null)
            {
                return(null);
            }

            IPublishedElement content = _EmbeddedContentService.ConvertValueToContent(data.Guid, data.ContentTypeAlias, data.DataJson);

            return(View(viewPath, content));
        }
Esempio n. 2
0
        private ActionResult ViewResult(LoadEmbeddedContentRequest data, string viewPath)
        {
            if (!string.IsNullOrEmpty(data.Culture))
            {
                _variationContextAccessor.VariationContext = new VariationContext(data.Culture);
            }

            if (string.IsNullOrWhiteSpace(data.Guid))
            {
                return(null);
            }

            if (string.IsNullOrWhiteSpace(data.ContentTypeAlias))
            {
                return(null);
            }

            if (data.DataJson == null)
            {
                return(null);
            }

            IPublishedElement content = _EmbeddedContentService.ConvertValueToContent(data.Guid, data.ContentTypeAlias, data.DataJson);

            return(View(viewPath, content));
        }
Esempio n. 3
0
        public ActionResult LoadEmbeddedContent([FromBody] LoadEmbeddedContentRequest data)
        {
            if (data == null)
            {
                return(null);
            }

            return(ViewResult(data, $"~/Views/Partials/Bento/{data.ContentTypeAlias}BackOffice.cshtml"));
        }