public List <TaskDto> Search(TaskSearchDto dto) { using (UnitOfWork uow = new UnitOfWork()) { var list = uow.GetRepository <Data.Context.Task>().GetAll(); //Ekrandan proje seçilmişse filtre olarak eklenecek if (dto.ProjectId > 0) { list = list.Where(p => p.ProjectId == dto.ProjectId); } //Ekrandan statü seçilmişse filtre olarak eklenecek if (dto.TaskStatusId > 0) { list = list.Where(p => p.TaskStatusId == dto.TaskStatusId); } //Ekrandan kişi seçilmişse filtre olarak eklenecek if (dto.UserId > 0) { list = list.Where(p => p.AssignTo == dto.UserId); } return(list.Select(MapperFactory.Map <Data.Context.Task, TaskDto>).ToList()); } }
public async Task <IActionResult> Index([FromQuery] TaskSearchDto searchDto) { //we are just returning data and because the domain contains all the business logic we can just get the model //and serialize the properties. var examples = await _taskRepository.Get(searchDto.Index, searchDto.Size == 0? 10 : searchDto.Size); return(new JsonResult(_mapper.Map <List <TaskDto> >(examples))); }
public async Task <PageModelDto <TaskLogDto> > GetLogPaged(TaskSearchDto searchDto) { PageModelDto <TaskLogDto> result = new PageModelDto <TaskLogDto>(); Expression <Func <SysTaskLog, bool> > whereCondition = x => true; if (searchDto.Id > 0) { whereCondition = whereCondition.And(x => x.ID == searchDto.Id); } var taskLogs = await _taskLogRepository.SelectAsync(t => t, whereCondition, t => t.ID, false); return(_mapper.Map <PageModelDto <TaskLogDto> >(taskLogs)); }
public async Task <List <TaskDto> > GetList(TaskSearchDto searchDto) { List <TaskDto> result = new List <TaskDto>(); Expression <Func <SysTask, bool> > whereCondition = x => true; if (searchDto.Name.IsNotNullOrWhiteSpace()) { whereCondition = whereCondition.And(x => x.Name.Contains(searchDto.Name)); } var tasks = await _taskRepository.SelectAsync(t => t, whereCondition, t => t.ModifyTime, false); return(_mapper.Map <List <TaskDto> >(tasks)); }
public async Task <PageModelDto <TaskLogDto> > GetLogPaged([FromQuery] TaskSearchDto searchDto) { return(await _taskAppService.GetLogPaged(searchDto)); }
public async Task <List <TaskDto> > GetList([FromQuery] TaskSearchDto searchDto) { return(await _taskAppService.GetList(searchDto)); }