Ejemplo n.º 1
0
        public async Task <IActionResult> GetAlbumById([FromRoute] int id)
        {
            var album = _albumsRepo.GetEntityById(id);
            var model = AlbumViewModel.FromAlbum(album);

            return(Ok(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetMostPopularAlbums()
        {
            var toprated = _albumsRepo.GetTopRated();
            var model    = toprated.Select(a => AlbumViewModel.FromAlbum(a));

            return(Ok(model));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetAllAlbums()
        {
            var albums = _albumsRepo.GetAllEntities();
            var model  = albums.Select(a => AlbumViewModel.FromAlbum(a));

            return(Ok(model));
        }
Ejemplo n.º 4
0
 public IEnumerable <AlbumViewModel> SearchBand([FromQuery] string search, [FromQuery] bool?hasMorethenSixMembers)
 {
     return(_albumsRepo.SearchEntity(search, hasMorethenSixMembers).Select(a => AlbumViewModel.FromAlbum(a)));
 }