/// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Employee> GetAsync(this IEmployeeOperations operations, string employeeId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(employeeId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        public static IList <Employee> Get(this IEmployeeOperations operations,
                                           DateTime?created,
                                           DateTime?updated,
                                           EmployeeStatusType?status,
                                           string externalId,
                                           ListOrderType?listOrder = null,
                                           short?limit             = null,
                                           bool isContinous        = false)
        {
            //return Task
            //    .Factory
            //    .StartNew(s => ((IEmployeeOperations)s).GetAsync(created, updated, status, externalId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
            //    .Unwrap()
            //    .GetAwaiter()
            //    .GetResult();

            var task = Task.Run(() => operations.GetWithHttpMessagesAsync(created, updated, status, externalId, listOrder, limit, isContinous, null));

            task.Wait();

            return(new ActiveList <Employee>
            {
                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 <Employee> > GetAsync(this IEmployeeOperations operations,
                                                       DateTime?created,
                                                       DateTime?updated,
                                                       EmployeeStatusType?status,
                                                       string externalId,
                                                       ListOrderType?listOrder             = null,
                                                       short?limit                         = null,
                                                       bool isContinous                    = false,
                                                       CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(created, updated, status, externalId, listOrder, limit, isContinous, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 4
0
 public void Setup()
 {
     employeeOperations = new EmployeeOperations();
 }
 /// <summary>
 /// Performs arithmetic operations
 /// </summary>
 public EmployeeController(IEmployeeOperations operations)
 {
     Debug.WriteLine("A new controller object is created");
     Operations = operations ?? throw new ArgumentNullException(nameof(operations));
 }
Ejemplo n.º 6
0
 public EmployeeController(IEmployeeOperations employeeOperations)
 {
     _employeeOperations = employeeOperations;
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='value'>
 /// </param>
 public static void Post(this IEmployeeOperations operations, Employee value)
 {
     Task.Factory.StartNew(s => ((IEmployeeOperations)s).PostAsync(value), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static Employee Get(this IEmployeeOperations operations, string employeeId)
 {
     return(Task.Factory.StartNew(s => ((IEmployeeOperations)s).GetAsync(employeeId), 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 IEmployeeOperations operations, string employeeId, Employee value, CancellationToken cancellationToken = default(CancellationToken))
 {
     await operations.PutWithHttpMessagesAsync(employeeId, value, null, cancellationToken).ConfigureAwait(false);
 }
 public EmployeeService(IEmployeeOperations empOps)
 {
     _empOps = empOps;
 }
Ejemplo n.º 11
0
 public EmployeeController(IEmployeeOperations operations)
 {
     employee = operations;
 }
Ejemplo n.º 12
0
 public EmployeeController(IEmployeeOperations employee)
 {
     _employee = employee;
 }