mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
fix scheduled event saving
This commit is contained in:
parent
d2c308c009
commit
91eec8c258
1 changed files with 6 additions and 2 deletions
|
|
@ -170,12 +170,16 @@ namespace PepperDash.Essentials
|
|||
{
|
||||
//update config based on key of scheduleEvent
|
||||
GetOrCreateScheduleGroup();
|
||||
var existingEvent = _config.ScheduledEvents.FirstOrDefault(e => e.Key == scheduledEvent.Key);
|
||||
var existingEventIndex = _config.ScheduledEvents.FindIndex((e) => e.Key == scheduledEvent.Key);
|
||||
|
||||
if (existingEvent == null)
|
||||
if (existingEventIndex < 0)
|
||||
{
|
||||
_config.ScheduledEvents.Add(scheduledEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
_config.ScheduledEvents[existingEventIndex] = scheduledEvent;
|
||||
}
|
||||
|
||||
//create or update event based on config
|
||||
CreateOrUpdateSingleEvent(scheduledEvent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue