Esempio n. 1
0
            public async Task <PublicationModel> GetPublication(MagazineModel magazineModel, [ScopedService] LibraryDbContext context, PublicationByIdDataLoader dataLoader, CancellationToken cancellationToken)
            {
                int publicationId = context.Publications
                                    .Where(x => x.MagazineId == magazineModel.Id)
                                    .Select(x => x.Id)
                                    .FirstOrDefault();

                return(await dataLoader.LoadAsync(publicationId, cancellationToken));
            }
Esempio n. 2
0
            public async Task <IReadOnlyList <PublicationModel> > GetPublications(PublisherModel publisherModel, PublicationByIdDataLoader dataLoader, [ScopedService] LibraryDbContext context, CancellationToken cancellationToken)
            {
                int[] publicationIds = await context.Publications
                                       .Where(x => x.PublisherId == publisherModel.Id)
                                       .Select(x => x.Id)
                                       .ToArrayAsync();

                return(await dataLoader.LoadAsync(publicationIds, cancellationToken));
            }