public async Task CreateCollectionAsync(EventCollection collection, CancellationToken cancellationToken) { await _eventCollectionAccessControlService .CheckEventCollectionUpdateAccessAsync(collection, cancellationToken); await _context.CreateAsync(collection, cancellationToken : cancellationToken); }
public async Task <EventCollection> GetCollectionByIdAsync(int id, EventCollectionRetrievalOptions options, CancellationToken cancellationToken) { options ??= new EventCollectionRetrievalOptions(); var collection = await _context.EventCollections .UseOptions(options) .FirstOrDefaultAsync(c => c.CollectionId == id, cancellationToken); if (options.ForUpdate) { await _eventCollectionAccessControlService .CheckEventCollectionUpdateAccessAsync(collection, cancellationToken); } return(collection ?? throw new NotFoundException($"Collection {id} not found.")); }