public JsonResult SaveZoneWidget(string module, string theme, string layout, string zone, string widget)
        {
            int currentWidgetCount = _nccWebSiteWidgetService.Load(theme, layout, zone).Count() + 1;
            var currentWebsite     = _nccWebSiteService.LoadAll().FirstOrDefault();
            var nccWebSiteWidget   = new NccWebSiteWidget()
            {
                LayoutName       = layout,
                WebSite          = currentWebsite,
                WidgetConfigJson = "",
                WidgetData       = "",
                ThemeId          = theme,
                WidgetId         = widget,
                WidgetOrder      = currentWidgetCount,
                Zone             = zone,
                ModuleName       = module
            };

            _nccWebSiteWidgetService.Save(nccWebSiteWidget);
            GlobalContext.WebSiteWidgets = _nccWebSiteWidgetService.LoadAll().OrderBy(x => x.WidgetOrder).ToList();

            return(Json(new ApiResponse()
            {
                IsSuccess = true, Message = "Save Successful.", Data = nccWebSiteWidget
            }));
        }
예제 #2
0
        public JsonResult SaveZoneWidget(string module, string theme, string layout, string zone, string widget)
        {
            var currentWebsite   = _nccWebSiteService.LoadAll().FirstOrDefault();
            var nccWebSiteWidget = new NccWebSiteWidget()
            {
                LayoutName       = layout,
                WebSite          = currentWebsite,
                WidgetConfigJson = "",
                WidgetData       = "",
                ThemeId          = theme,
                WidgetId         = widget,
                WidgetOrder      = 1,
                Zone             = zone,
                ModuleId         = module,
            };

            _nccWebSiteWidgetService.Save(nccWebSiteWidget);
            GlobalConfig.WebSiteWidgets = _nccWebSiteWidgetService.LoadAll();

            return(Json(new ApiResponse()
            {
                IsSuccess = true, Message = "Save Successful."
            }));
        }