Пример #1
0
        //######################################
        // AddNotificationTriggerInternal
        //######################################

        internal List <NotificationTrigger> AddNotificationTriggerInternal(TriggerParameters parameters, bool resolve,
                                                                           Action <Type, int> errorCallback = null, Func <bool> shouldStop = null)
        {
            if (resolve)
            {
                Action addTrigger = () => SetNotificationTrigger(parameters);
                Func <List <NotificationTrigger> > getTrigger = () => GetNotificationTriggers(parameters.ObjectId).Where(t => !t.Inherited).ToList();

                var objs = ResolveWithDiff(addTrigger, getTrigger, (b, a) => ResponseParser.ExceptTrigger(b, a, parameters), errorCallback, shouldStop);

                return(objs);
            }
            else
            {
                SetNotificationTrigger(parameters);

                return(null);
            }
        }
Пример #2
0
        internal async Task <List <NotificationTrigger> > AddNotificationTriggerInternalAsync(TriggerParameters parameters, bool resolve,
                                                                                              Action <Type, int> errorCallback = null, Func <bool> shouldStop = null)
        {
            if (resolve)
            {
                Func <Task> addTrigger = async() => await SetNotificationTriggerAsync(parameters).ConfigureAwait(false);

                Func <Task <List <NotificationTrigger> > > getTrigger = async() => (await GetNotificationTriggersAsync(parameters.ObjectId).ConfigureAwait(false)).Where(t => !t.Inherited).ToList();

                var objs = await ResolveWithDiffAsync(addTrigger, getTrigger, (b, a) => ResponseParser.ExceptTrigger(b, a, parameters), errorCallback, shouldStop).ConfigureAwait(false);

                return(objs);
            }
            else
            {
                SetNotificationTrigger(parameters);

                return(null);
            }
        }