Пример #1
0
        public virtual IActionResult List(WidgetZoneSearchModel searchModel)
        {
            //return access denied result if customer has no permissions
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageWidgets))
            {
                return(AccessDeniedDataTablesJson());
            }

            var gridModel = _widgetZoneModelFactory.PrepareWidgetZonePagedListModel(searchModel);

            return(Json(gridModel));
        }
Пример #2
0
        public virtual IActionResult List()
        {
            //return access denied page if customer has no permissions
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageWidgets))
            {
                return(AccessDeniedView());
            }

            var model = new WidgetZoneSearchModel();

            model.SetGridPageSize();

            return(View("~/Plugins/Widgets.qBoSlider/Views/Admin/WidgetZone/List.cshtml", model));
        }
        /// <summary>
        /// Prepare widget zone paged list model
        /// </summary>
        /// <param name="searchModel">Search model</param>
        /// <returns>Paged list model</returns>
        public virtual WidgetZoneSearchModel.WidgetZoneList PrepareWidgetZonePagedListModel(WidgetZoneSearchModel searchModel)
        {
            var widgetZones = _widgetZoneService.GetWidgetZones(
                name: searchModel.SearchWidgetZoneName,
                systemName: searchModel.SearchWidgetZoneSystemName,
                showHidden: true,
                pageIndex: searchModel.Page - 1,
                pageSize: searchModel.PageSize);
            var gridModel = new WidgetZoneSearchModel.WidgetZoneList().PrepareToGrid(searchModel, widgetZones, () =>
            {
                return(widgetZones.Select(widgetZone =>
                {
                    return new WidgetZoneSearchModel.WidgetZoneListItem()
                    {
                        Id = widgetZone.Id,
                        Name = widgetZone.Name,
                        SystemName = widgetZone.SystemName,
                        Published = widgetZone.Published
                    };
                }));
            });

            return(gridModel);
        }