/// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <Fee> Get(this IFeeOperations operations, string locationId, bool isContinous = false) { //return new ActiveList<Fee> //{ // _Fees = Task // .Factory // .StartNew(s => ((IFeeOperations)s).GetAsync(locationId, beginTime, endTime, listOrder, limit), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default) // .Unwrap() // .GetAwaiter() // .GetResult(), //}; var task = Task.Run(() => operations.GetWithHttpMessagesAsync(locationId, null)); task.Wait(); return(new ActiveList <Fee> { InitialUri = task.Result.Request.RequestUri.AbsoluteUri, Collection = task.Result.Body, NextUri = task.Result.ToNextUri(), Operations = operations, IsContinous = isContinous, }); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <Fee> > GetAsync(this IFeeOperations operations, string locationId, bool isContinous = false, CancellationToken cancellationToken = default(CancellationToken)) { using (var result = await operations.GetWithHttpMessagesAsync(locationId, null, cancellationToken).ConfigureAwait(false)) { return(new ActiveList <Fee> { InitialUri = result.Request.RequestUri.AbsoluteUri, Collection = result.Body, NextUri = result.ToNextUri(), Operations = operations, IsContinous = isContinous, CancellationToken = cancellationToken, }); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='value'> /// </param> public static void Post(this IFeeOperations operations, string locationId, Fee value) { Task.Factory.StartNew(s => ((IFeeOperations)s).PostAsync(locationId, value), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='value'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutAsync(this IFeeOperations operations, string locationId, string id, Fee value, CancellationToken cancellationToken = default(CancellationToken)) { await operations.PutWithHttpMessagesAsync(locationId, id, value, null, cancellationToken).ConfigureAwait(false); }