Beispiel #1
0
        public IViewComponentResult Invoke(string widgetZone, object additionalData)
        {
            var widget = _widgetZoneService.GetWidgetZoneBySystemName(widgetZone);

            //return empty result if widget zone has no slider
            if (widget == null)
            {
                return(Content(string.Empty));
            }

            //return empty result if widget zone isn't published
            if (!widget.Published)
            {
                return(Content(string.Empty));
            }

            //return empty page if widget zone aren't authorized
            if (!_aclService.Authorize(widget))
            {
                return(Content(string.Empty));
            }

            //return nothing if widget zone aren't authorized in current store
            if (!_storeMappingService.Authorize(widget))
            {
                return(Content(string.Empty));
            }

            //return empty result, if widget zone has no published slides
            var slides = _widgetZoneService.GetWidgetZoneSlides(widget.Id);

            if (!slides.Any())
            {
                return(Content(string.Empty));
            }

            var model = _publicModelFactory.PrepareWidgetZoneModel(widget);

            return(View("~/Plugins/Widgets.qBoSlider/Views/Public/PublicInfo.cshtml", model));
        }
Beispiel #2
0
        public virtual IActionResult SystemNameReservedWarning(int widgetZoneId, string systemName)
        {
            if (string.IsNullOrEmpty(systemName))
            {
                return(Json(new { Result = string.Empty }));
            }

            var widgetZone = _widgetZoneService.GetWidgetZoneBySystemName(systemName);

            //back null if widget zone isn't exist
            if (widgetZone == null)
            {
                return(Json(new { Result = string.Empty }));
            }
            //back null if widget zone is exist and it's already open
            if (widgetZone != null && widgetZone.Id == widgetZoneId)
            {
                return(Json(new { Result = string.Empty }));
            }

            return(Json(new { Result = _localizationService.GetResource("Nop.Plugin.Baroque.Widgets.qBoSlider.Admin.WidgetZone.WidgetZoneAlreadyReserved") }));
        }