Esempio n. 1
0
        public async Task <List <Task> > GetTasksDataAsync()
        {
            var taskModel = await(
                from task in this.db.Task.Include(x => x.TaskIssue).ThenInclude(x => x.Issue)
                join addResource in this.db.Resource on task.ResourceId equals addResource.Id
                into TaskResourceData
                from resource in TaskResourceData.DefaultIfEmpty()
                select task
                ).ToListAsync();

            return(taskModel);
        }
Esempio n. 2
0
        public async Task <TaskModel> GetTaskById(Guid TaskId)
        {
            var taskModel = await(
                from task in this.db.Task
                join addResource in this.db.Resource on task.ResourceId equals addResource.Id
                into TaskResourceData
                from resource in TaskResourceData.DefaultIfEmpty()
                where task.Id == TaskId
                select new TaskModel {
                Task = task, Resource = resource
            }
                ).FirstOrDefaultAsync();

            return(taskModel);
        }
Esempio n. 3
0
        public async Task <List <TaskListModel> > GetTasksListDataAsync()
        {
            var taskDataList = await(
                from task in this.db.Task
                join addResource in this.db.Resource on task.ResourceId equals addResource.Id
                into TaskResourceData
                from resource in TaskResourceData.DefaultIfEmpty()
                select new TaskListModel {
                TaskId            = task.Id,
                TaskName          = task.Name,
                ExpectedStartDate = task.ExpectedStartDate,
                ExpectedEndDate   = task.ExpectedEndDate,
                TaskType          = task.TaskType,
                ResourceName      = resource.Name
            }
                ).ToListAsync();

            return(taskDataList);
        }