public async Task <IReadOnlyList <PlannerItemModel> > Execute() { var query = repository.GetAll() .Where(item => item.CompletionDate == null && item.PlannedEndTime < dateTimeProvider.Now); return(await mapper.ProjectTo <PlannerItemModel>(query).ToListAsync()); }
public async Task <IReadOnlyList <PlannerItemModel> > Execute(DateTime?startDate, DateTime?endDate) { IQueryable <PlannerItem> itemQuery; if (startDate.HasValue && endDate.HasValue) { itemQuery = repository.GetAll().Where(item => item.PlannedActionDate.Date >= startDate.Value.Date && item.PlannedActionDate.Date <= endDate.Value.Date); } else if (startDate.HasValue) { itemQuery = repository.GetAll().Where(item => item.PlannedActionDate.Date == startDate.Value.Date); } else { itemQuery = repository.GetAll(); } return(await mapper.ProjectTo <PlannerItemModel>(itemQuery).ToListAsync()); }
public async Task <IReadOnlyList <PlannerItemModel> > Execute() { var query = plannerItemRepository.GetAll().Where(p => p.CompletionDate.HasValue); return(await mapper.ProjectTo <PlannerItemModel>(query).ToListAsync()); }