public async Task <ICollection <UserTaskHead> > GetUserTaskHeads(FilterUserTaskHeadModel filterModel) { var filters = filterModel.GetFilters(); Expression <Func <UserTaskHead, bool> > resultFilter = filters.FirstOrDefault(); foreach (var filter in filters.Skip(1)) { resultFilter = resultFilter.And(filter); } var userTaskHeads = (await _repository.Where(resultFilter)) .OrderBy(c => c.TaskHead.Order) .ToList(); userTaskHeads.ForEach(c => c.UserSubTasks = c.UserSubTasks.OrderBy(l => l.SubTask.Order).ToList()); return(userTaskHeads); }
public async Task <IActionResult> Get(FilterUserTaskHeadModel model) { var TaskHeads = await _taskHeadService.GetUserTaskHeads(model); return(Ok(TaskHeads.Select(Mapper.Map <UserTaskHeadShortcutModel>))); }