コード例 #1
0
        public async Task <ReportTerminu> GetReport()
        {
            DateTime today            = timeService.GetCurrentDate();
            DateTime datumOdInclusive = ReportHelpers.GetZacatekSkolnihoRoku(timeService);

            return(new ReportTerminu
            {
                ObsazenostTerminu = await terminDataSource.Data.Where(termin => (termin.Datum >= datumOdInclusive) && (termin.Datum < today))
                                    .OrderBy(item => item.Datum)
                                    .Select(termin => new ReportTerminuItem
                {
                    Datum = termin.Datum,
                    PocetHracu = termin.Prihlasky.Where(prihlaska => prihlaska.Deleted == null).Count()
                }).ToListAsync()
            });
        }
コード例 #2
0
        public async Task <ReportOsob> GetReport()
        {
            DateTime today            = timeService.GetCurrentDate();
            DateTime datumOdInclusive = ReportHelpers.GetZacatekSkolnihoRoku(timeService);

            return(new ReportOsob
            {
                UcastHracu = (await osobaDataSource.Data.Select(osoba =>
                                                                new ReportOsobItem
                {
                    PrijmeniJmeno = osoba.PrijmeniJmeno,
                    PocetTerminu = osoba.Prihlasky.Where(prihlaska => (prihlaska.Termin.Datum >= datumOdInclusive) && (prihlaska.Termin.Datum < today) && (prihlaska.Termin.Deleted == null) && (prihlaska.Deleted == null)).Count()
                })
                              .ToListAsync())
                             .Where(item => item.PocetTerminu > 0)    // in memory
                             .OrderBy(item => item.PrijmeniJmeno)
                             .ToList()
            });
        }