/// <summary> /// Returns a collection of <see cref="Altask.Data.Model.Task"/> objects matching the specified filter. /// </summary> /// <param name="filter">A <see cref="Altask.www.Models.TaskListOptions"/> object on which to filter.</param> /// <returns>Returns a <see cref="Altask.Data.EntityResult"/> indicating success or failure.</returns> public virtual async Task <ActionResult> List(TaskListOptions filter) { ThrowIfDisposed(); if (filter == null) { filter = new TaskListOptions(); } var dtoTasks = new List <Altask.Data.Dto.Task>(); var task = await Context.Tasks.AsNoTracking().Where(filter.GetPredicate()) .Include(e => e.Form) .Include(e => e.Schedules) .Include(e => e.Category) .Include(e => e.Type) .Include(e => e.Alerts) .ToListAsync(); foreach (var item in task) { dtoTasks.Add(item.ToDto()); } return(Ok(new { tasks = dtoTasks }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Lists all of the Tasks that are associated with the specified Job. /// </summary> /// <remarks> /// For multi-instance Tasks, information such as affinityId, executionInfo and /// nodeInfo refer to the primary Task. Use the list subtasks API to retrieve /// information about subtasks. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='jobId'> /// The ID of the Job. /// </param> /// <param name='taskListOptions'> /// Additional parameters for the operation /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <CloudTask> > ListAsync(this ITaskOperations operations, string jobId, TaskListOptions taskListOptions = default(TaskListOptions), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(jobId, taskListOptions, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Lists all of the Tasks that are associated with the specified Job. /// </summary> /// <remarks> /// For multi-instance Tasks, information such as affinityId, executionInfo and /// nodeInfo refer to the primary Task. Use the list subtasks API to retrieve /// information about subtasks. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='jobId'> /// The ID of the Job. /// </param> /// <param name='taskListOptions'> /// Additional parameters for the operation /// </param> public static IPage <CloudTask> List(this ITaskOperations operations, string jobId, TaskListOptions taskListOptions = default(TaskListOptions)) { return(operations.ListAsync(jobId, taskListOptions).GetAwaiter().GetResult()); }
/// <summary> /// Lists all of the tasks that are associated with the specified job. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='jobId'> /// The id of the job. /// </param> /// <param name='taskListOptions'> /// Additional parameters for the operation /// </param> public static Microsoft.Rest.Azure.IPage <CloudTask> List(this ITaskOperations operations, string jobId, TaskListOptions taskListOptions = default(TaskListOptions)) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((ITaskOperations)s).ListAsync(jobId, taskListOptions), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }