public ActionResult LoadLayoutList(bool isHorizontal)
        {
            ILayoutService layoutService = DependencyUtils.Resolve <ILayoutService>();
            var            layoutList    = layoutService.Get(a => a.isHorizontal == isHorizontal).ToList();
            var            layoutVMs     = new List <Models.LayoutVM>();

            if (layoutList != null)
            {
                foreach (var item in layoutList)
                {
                    var l = new Models.LayoutVM
                    {
                        LayoutID     = item.LayoutID,
                        Title        = item.Title,
                        isHorizontal = item.isHorizontal,
                        Description  = item.Description,
                        URL          = item.URL,
                    };
                    layoutVMs.Add(l);
                }
            }
            //return layoutVMs;
            return(Json(new
            {
                LayoutVMs = layoutVMs,
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LoadLayout(int layoutId)
        {
            ILayoutService layoutService = DependencyUtils.Resolve <ILayoutService>();
            string         layoutSrc     = "";

            layoutSrc = layoutService.Get(a => a.LayoutID == layoutId).FirstOrDefault()?.LayoutSrc;
            return(PartialView(layoutSrc));
        }
예제 #3
0
 public IActionResult PageZones(QueryContext context)
 {
     var page = Service.Get(context.PageID);
     var layout = _layoutService.Get(page.LayoutId);
     var viewModel = new LayoutZonesViewModel
     {
         Page = page,
         Layout = layout,
         PageID = context.PageID,
         LayoutID = layout.ID,
         Zones = _zoneService.GetZonesByPageId(context.PageID),
         Widgets = _widgetService.GetAllByPage(Service.Get(context.PageID)),
         LayoutHtml = layout.Html
     };
     return View(viewModel);
 }
        private LayoutEntity CreateLayout(string themeName)
        {
            LayoutEntity layoutEntity = _layoutService.Get(m => m.Title == themeName).FirstOrDefault();

            if (layoutEntity == null)
            {
                layoutEntity = new LayoutEntity
                {
                    Title      = themeName,
                    LayoutName = themeName
                };
                layoutEntity.Zones = new ZoneCollection();
                layoutEntity.Html  = new LayoutHtmlCollection();
                string[] zoneNames = new string[] { "Header", "Content", "Footer" };
                for (int i = 0; i < zoneNames.Length; i++)
                {
                    ZoneEntity zone = new ZoneEntity
                    {
                        ZoneName    = zoneNames[i],
                        HeadingCode = $"ZONE-{i}"
                    };
                    layoutEntity.Zones.Add(zone);
                    layoutEntity.Html.Add(new LayoutHtml
                    {
                        Html = "<div class=\"main custom-style container-fluid\"><div class=\"additional row\"><div class=\"additional col-md-12\"><div class=\"colContent row\"><div class=\"additional zone\">"
                    });
                    layoutEntity.Html.Add(new LayoutHtml {
                        Html = ZoneEntity.ZoneTag
                    });
                    layoutEntity.Html.Add(new LayoutHtml {
                        Html = zone.HeadingCode
                    });
                    layoutEntity.Html.Add(new LayoutHtml {
                        Html = ZoneEntity.ZoneEndTag
                    });
                    layoutEntity.Html.Add(new LayoutHtml {
                        Html = "</div></div></div></div></div>"
                    });
                }
                _layoutService.Add(layoutEntity);
            }
            return(layoutEntity);
        }