public async Task <IEnumerable <PoetryVolumeViewModel> > Handle(GetPoetryVolumesByAuthorIdCommand request, CancellationToken cancellationToken)
        {
            IQueryable <PoetryVolumeAuthorship> authorizedVolumes = _authorizedRepository.GetEntitiesByAuthorId(request.AuthorId);

            IQueryable <PoetryVolumeViewModel> volumesToReturn = _autoMapper.ProjectTo <PoetryVolumeViewModel>(authorizedVolumes);

            return(await volumesToReturn.ToListAsync());
        }
Exemplo n.º 2
0
        public async Task <ICollection <AlbumPreviewModel> > Handle(GetAlbumsByBandIdCommand request, CancellationToken cancellationToken)
        {
            IQueryable <MusicalAlbum> albums = _albumRepository.GetEntitiesByAuthorId(
                request.BandId, x => x.Include(a => a.Band));

            List <AlbumPreviewModel> responseObjects = await _autoMapper.ProjectTo <AlbumPreviewModel>(albums).ToListAsync();

            return(responseObjects);
        }