/// <summary> /// Deletes a rule. /// </summary> /// <param name="rule">The rule to delete.</param> /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param> /// <returns> /// A task that represents the asynchronous operation. /// </returns> public virtual Task <ValidationResult> DeleteAsync(RuleItem rule, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (rule == null) { throw new ArgumentNullException("rule"); } return(Store.DeleteAsync(rule, cancellationToken)); }
/// <summary> /// Inserts a rule. /// </summary> /// <param name="rule">The rule to insert.</param> /// <param name="user">The user who owns the rule.</param> /// <param name="cancellationToken">A token to observe while waiting for the task to complete.</param> /// <returns> /// A task that represents the asynchronous operation. /// </returns> /// <exception cref="System.ArgumentNullException"> /// rule /// or /// </exception> public virtual Task <ValidationResult> CreateAsync(RuleItem rule, AccountItem user, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (rule == null) { throw new ArgumentNullException("rule"); } if (user == null) { throw new ArgumentNullException(nameof(user)); } return(Store.CreateAsync(rule, user, cancellationToken)); }