private async Task <IEnumerable <TimeReport> > GetLastUserTimeReports(User user) { var lastReports = await timeReportRepository.GetUserReportsInInterval(user.Id, suggestionStartDate, suggestionEndDate); await referenceLoader.LoadForTimeReports(lastReports); return(lastReports.Where(r => r.Activity.Type.ImportanceFactor != 0)); }
public async Task <TimeReportsIntervalViewModel> GetTimeReportsInInterval(DateTime startDate, DateTime endDate) { if (endDate < startDate) { throw new IncorrectInputDateException("Start date bigger then end date"); } var timeReports = await timeReportRepository.GetUserReportsInInterval(await GetUserId(), startDate, endDate); await referenceLoader.LoadForTimeReports(timeReports); return(new TimeReportsIntervalViewModel(AgregateTimeReports(timeReports), TimeConverter.ToJSONString(startDate), TimeConverter.ToJSONString(endDate))); }