コード例 #1
0
        public async Task <List <TaskListDto> > GetAll(GetAllTasksInput input)
        {
            var tasks = await _taskRepository
                        .GetAll()
                        .Include(t => t.AssignedPerson)
                        .WhereIf(input.State.HasValue, o => o.State == input.State.Value)
                        .OrderByDescending(o => o.CreationTime)
                        .ToListAsync();

            return(new List <TaskListDto>(ObjectMapper.Map <List <TaskListDto> >(tasks)));
        }
コード例 #2
0
        public async Task <ListResultOutput <TaskListDto> > GetAll(GetAllTasksInput input)
        {
            var tasks = await _taskRepository
                        .GetAll()
                        .WhereIf(input.State.HasValue, t => t.State == input.State.Value)
                        .OrderByDescending(t => t.CreationTime)
                        .ToListAsync();

            return(new ListResultOutput <TaskListDto>(
                       ObjectMapper.Map <List <TaskListDto> >(tasks)
                       ));
        }
コード例 #3
0
ファイル: TaskAppService.cs プロジェクト: zzz-jim/ABP-Demos
        public async Task <ListResultDto <TaskListDto> > GetAllAsync(GetAllTasksInput input)
        {
            var tasks = await _taskRepository.GetAll()
                        .Include(t => t.AssignedPerson)//And including the Task.AssignedPerson property to the query. Just added the Include line. Thus, GetAll method will return Assigned person information with the tasks. Since we used AutoMapper, new properties will also be copied to DTO automatically.
                        .WhereIf(input.State.HasValue, t => t.State == input.State.Value)
                        .OrderByDescending(t => t.CreationTime)
                        .ToListAsync();

            return(new ListResultDto <TaskListDto>(ObjectMapper.Map <List <TaskListDto> >(tasks)));

            //var tasks = await _taskRepository
            //   .GetAll()
            //   .WhereIf(input.State.HasValue, t => t.State == input.State.Value)
            //   .OrderByDescending(t => t.CreationTime)
            //   .ToListAsync();

            //return new ListResultDto<TaskListDto>(
            //    ObjectMapper.Map<List<TaskListDto>>(tasks)
            //);
        }