Example #1
0
        public async Task Remove(ViewDeleteCriteria criteria, CancellationToken cancellationToken = default(CancellationToken))
        {
            Argument.IsNotNullOrEmpty(criteria?.Name, nameof(criteria.Name));

            var parameters = criteria.ToParameters();

            await apiConnection.Delete($"views/{criteria.Name}", parameters, HttpMessageTransformer, cancellationToken)
            .ConfigureAwait(false);
        }
Example #2
0
        public async Task Remove(ViewDeleteCriteria criteria)
        {
            Argument.IsNotNullOrEmpty(criteria?.Name, nameof(criteria.Name));

            var parameters = criteria.ToParameters();

            await Client.Delete($"{ApiKeys.Endpoint}views/{criteria.Name}", ApiKeys.ApiToken, parameters)
            .ConfigureAwait(false);
        }
 public async Task Remove(ViewDeleteCriteria criteria)
 {
     try
     {
         ViewRepository.Remove(criteria);
     }
     catch (Exception ex)
     {
         Logger.Error("ViewService.Remove failed", this, ex);
     }
 }
        internal static IEnumerable <KeyValuePair <string, string> > ToParameters(this ViewDeleteCriteria criteria)
        {
            var builder = new ParameterBuilder();

            if ((criteria?.Cascade & ViewCascadeOptions.CascadeSessions).GetValueOrDefault() != 0)
            {
                builder.Add("cascade", "session");
            }
            if ((criteria?.Cascade & ViewCascadeOptions.CascadeModels).GetValueOrDefault() != 0)
            {
                builder.Add("cascade", "model");
            }
            if ((criteria?.Cascade & ViewCascadeOptions.CascadeVocabularies).GetValueOrDefault() != 0)
            {
                builder.Add("cascade", "vocabulary");
            }

            return(builder.GetParameters());
        }