public int?CreateOrUpdateSchedule(ApiSchedule schedule) { if (schedule.Id == 0) { return(client.Post("schedules/", schedule)); } client.Put($"schedules/{schedule.Id}", schedule); return(schedule.Id); }
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(); }