Пример #1
0
        public async Task <IEnumerable <ReportToSendDto> > GetTodayReports(Guid soldierOnDutyId)
        {
            var companyId = (Guid)_soldierRepository.GetById(soldierOnDutyId).Result.CompanyId;
            var reports   = await _reportRepository.GetAll(companyId);

            var todayReports = reports.Where(x => x.Date.Date == DateTime.Today.Date);

            return(todayReports.Select(x => ReportMapper.ReportToSendMap(x, _soldierRepository)));
        }
Пример #2
0
        public async Task <IEnumerable <ReportToSendDto> > GetReports(Guid soldierOnDutyId)
        {
            var companyId = Guid.Empty;
            var companies = await _companyRepository.GetAll();

            foreach (var company in companies)
            {
                if (company.CommanderId == soldierOnDutyId)
                {
                    companyId = company.Id;
                    break;
                }
            }
            var reports = await _reportRepository.GetAll(companyId);

            return(reports.Select(x => ReportMapper.ReportToSendMap(x, _soldierRepository)));
        }