public IEnumerable <TaskApiModel> GetTasksForUser(string user, string searchFor, int pageSize, int pageIndex) { return(TasksService.GetNextTasksForUser(new GetNextTasksForUserRequest { User = user, Domain = string.Empty, WorkflowOid = Guid.Empty, SearchFor = searchFor, PageIndex = pageIndex, PageSize = pageSize }).Tasks .Select(t => TheModelFactory.Create(t, GetAttachedDocuments(t.TaskOid)))); }
/* GetTasksList * TODO: To improve performance we should get the tasks to display * from ther server without getting all the records all the time. */ /// <summary> /// Get Tasks List /// </summary> /// <param name="filterModel">FilterModel</param> /// <returns>TaskListModel</returns> private TaskListModel GetTasksList(FilterModel filterModel) { var getNextTasksForUserRequest = new GetNextTasksForUserRequest { User = HttpContext.User.Identity.Name, WorkflowOid = Guid.Empty, Domain = filterModel.Domain == Domains.All ? string.Empty : filterModel.Domain, }; GetNextTasksForUserResponse tasks = TasksService.GetNextTasksForUser(getNextTasksForUserRequest); var filter = new TaskFilter(filterModel); var trimedTasks = filter.RunSearch(tasks.Tasks); var taskList = CreateTaskList(filter, trimedTasks); return(new TaskListModel { Tasks = taskList }); }