public async Task <Collection <EventEntry> > GetEntriesByEventAsync( int eventId, SortOptions <EventEntry, EventEntryEntity> sortOptions, SearchOptions <EventEntry, EventEntryEntity> searchOptions, CancellationToken ct) { IQueryable <EventEntryEntity> query = _context.EventEntries.Where(r => r.eventId == eventId); query = searchOptions.Apply(query); query = sortOptions.Apply(query); var items = await query .ProjectTo <EventEntry>() .ToArrayAsync(ct); AttemptsProcessor ap = new AttemptsProcessor(_context, eventId); foreach (var ent in items) { EventMarks em = await ap.GetAttempts(ent.entryId, ct); ent.Marks = em.Attempts; ent.MarkType = em.MarkType; } return(new Collection <EventEntry> { Value = items }); }
public async Task <Collection <Attempt> > GetMarksByEntryAsync( int eventId, int entryId, CancellationToken ct) { _attProcessor = new AttemptsProcessor(_context, eventId); var items = await _attProcessor.GetAttempts(entryId, ct); return(new Collection <Attempt> { Value = items.Attempts }); }