Esempio n. 1
0
        public async Task <IActionResult> Index()
        {
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageDynamicResources))
            {
                return(Forbid());
            }

            var layers = await _layerService.GetDynamicResourcesAsync();

            // var widgets = await _layerService.GetLayerWidgetsMetadataAsync(c => c.Latest == true);

            var model = new DynamicResourcesIndexViewModel {
                DynamicResources = layers.DynamicResources.ToList()
            };

            // var siteSettings = await _siteService.GetSiteSettingsAsync();

            // model.Zones = siteSettings.As<LayerSettings>().Zones ?? Array.Empty<string>();
            // model.Widgets = new Dictionary<string, List<dynamic>>();

            // foreach (var widget in widgets.OrderBy(x => x.Position))
            // {
            //     var zone = widget.Zone;
            //     List<dynamic> list;
            //     if (!model.Widgets.TryGetValue(zone, out list))
            //     {
            //         model.Widgets.Add(zone, list = new List<dynamic>());
            //     }
            //
            //     list.Add(await _contentItemDisplayManager.BuildDisplayAsync(widget.ContentItem, _updateModelAccessor.ModelUpdater, "SummaryAdmin"));
            // }

            return(View(model));
        }
Esempio n. 2
0
        public async Task <IActionResult> Index(DynamicResourcesIndexViewModel model)
        {
            if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageDynamicResources))
            {
                return(Forbid());
            }

            return(RedirectToAction("Index"));
        }