Пример #1
0
        public int?CreateOrUpdateSchedule(ApiSchedule schedule)
        {
            if (schedule.Id == 0)
            {
                return(client.Post("schedules/", schedule));
            }

            client.Put($"schedules/{schedule.Id}", schedule);
            return(schedule.Id);
        }
Пример #2
0
        public async Task Save()
        {
            if (!IsValid || !IsDirty)
            {
                return;
            }

            if (!await shell.ShowWarningAffirmativeDialogAsync(Id > 0
                ? "Save these schedule parameters?"
                : "Create this schedule?"))
            {
                return;
            }

            var editedSchedule =
                new ApiSchedule {
                Id = Id ?? 0, Name = Name, Schedule = FullExpression
            };

            cachedService.CreateOrUpdateSchedule(editedSchedule);
            Close();
            cachedService.RefreshSchedules();
        }