예제 #1
0
        public async Task RemoveFromZoneAsync(string zone, WidgetPositionConfigModel config)
        {
            var widgetZones = _widgetConfigurationData;

            if (widgetZones.ContainsKey(zone) && widgetZones[zone].Any(t => t.Id == config.Id))
            {
                var find = widgetZones[zone].First(t => t.Id == config.Id);

                widgetZones[zone].Remove(find);
            }

            await SaveConfigFileAsync();
        }
예제 #2
0
        public async Task AddToZoneAsync(string zone, WidgetPositionConfigModel config)
        {
            config.Id = config.Id == Guid.Empty ? Guid.NewGuid() : config.Id;

            if (!_widgetConfigurationData.ContainsKey(zone))
            {
                _widgetConfigurationData[zone] = new List <WidgetPositionConfigModel>();
            }

            _widgetConfigurationData[zone].Add(config);

            await SaveConfigFileAsync();
        }