コード例 #1
0
        public async Task <ActionResult> Index(GetAllTaskInput input)
        {
            var output = await _taskAppService.GetAll(input);

            var model = new IndexViewModel(output.Items)
            {
                SelectedTaskState = input.State
            };

            return(View(model));
        }
コード例 #2
0
        public async Task <ListResultDto <TaskListDto> > GetAll(GetAllTaskInput input)
        {
            var tasks = await _taskRepository
                        .GetAll()
                        .Include(t => t.AssignedEmployee)
                        .WhereIf(input.State.HasValue, task => task.State == input.State.Value)
                        .OrderByDescending(task => task.CreationTime)
                        .ToListAsync();

            try
            {
                var dtos = ObjectMapper.Map <List <TaskListDto> >(tasks);

                return(new ListResultDto <TaskListDto>(dtos));
            }
            catch (Exception e)
            {
                throw (e);
            }
        }