public ActionResult<IEnumerable<AlbumDto>> GetAlbumsForBand(Guid bandId)
 {
     if (!_bandAlbumRepository.BandExists(bandId))
     {
         return NotFound();
     }
     IEnumerable<Entities.Album> albums = _bandAlbumRepository.GetAlbums(bandId);
     return Ok(_mapper.Map<IEnumerable<AlbumDto>>(albums));
 }
        public ActionResult <IEnumerable <AlbumsDTO> > GetAlbumsForBand(Guid bandId)
        {
            //if (!_bandAlbumRepository.BandExists(bandId))
            //    return NotFound();

            var albumsFromRepo = _bandAlbumRepository.GetAlbums(bandId);

            return(Ok(_mapper.Map <IEnumerable <AlbumsDTO> >(albumsFromRepo)));
        }
        public ActionResult <IEnumerable <AlbumDto> > GetAlbumsFromBand(Guid bandId)
        {
            IEnumerable <Entity.Album> AlbumFromPro = _bandAlbumRepository.GetAlbums(bandId);

            if (AlbumFromPro != null)
            {
                return(Ok(_mapper.Map <IEnumerable <AlbumDto> >(AlbumFromPro)));
            }
            return(NotFound());
        }
Beispiel #4
0
        public ActionResult <IEnumerable <AlbumDto> > GetAlbumsFromBands(Guid bandId)
        {
            if (!_bandAlbumRepository.BandExists(bandId))
            {
                return(NotFound());
            }
            var albumsRepo = _bandAlbumRepository.GetAlbums(bandId);

            return(Ok(_mapper.Map <IEnumerable <AlbumDto> >(albumsRepo)));
        }
Beispiel #5
0
        public ActionResult <IEnumerable <AlbumDto> > GetAlbums(Guid bandId)
        {
            if (!_repository.IsBandExists(bandId))
            {
                return(NotFound());
            }
            var albums = _repository.GetAlbums(bandId);

            return(Ok(_mapper.Map <IEnumerable <AlbumDto> >(albums)));
        }
Beispiel #6
0
        public ActionResult <IEnumerable <AlbumDto> > GetAlbumsForBand(Guid bandId)
        {
            if (!_repo.BandExist(bandId))
            {
                return(NotFound());
            }
            var albumsFromRepo = _repo.GetAlbums(bandId);

            return(Ok(_mapper.Map <IEnumerable <AlbumDto> >(albumsFromRepo)));
        }
Beispiel #7
0
        public ActionResult <IEnumerable <AlbumDto> > GetAlbumsForBand(Guid bandID)
        {
            if (!_bandAlbumRepository.BandExists(bandID))
            {
                return(NotFound());
            }

            var albumsFromRepo = _bandAlbumRepository.GetAlbums(bandID);

            return(new OkObjectResult(_mapper.Map <IEnumerable <AlbumDto> >(albumsFromRepo)));
        }
        public async Task <ActionResult <IEnumerable <AlbumDto> > > GetAlbumsForBand(Guid bandId)
        {
            if (!await _bandAlbumRepository.BandExists(bandId))
            {
                return(NotFound());
            }

            var albumsFromRepo = await _bandAlbumRepository.GetAlbums(bandId);

            return(Ok(_mapper.Map <IEnumerable <AlbumDto> >(albumsFromRepo))); // using the autoMapper in Profile here
        }
Beispiel #9
0
        public ActionResult DeleteBand(Guid bandId)
        {
            if (!_bandAlbumRepository.BandExists(bandId))
            {
                return(NotFound());
            }
            // Look for all related albums
            IEnumerable <Album> albums = _bandAlbumRepository.GetAlbums(bandId);

            // Delete all related albums
            _bandAlbumRepository.DeleteAlbums(albums);
            // Look for band
            var band = _bandAlbumRepository.GetBand(bandId);

            // Delete band
            _bandAlbumRepository.DeleteBand(band);
            _bandAlbumRepository.Save();
            return(NoContent());
        }
Beispiel #10
0
        public ActionResult <IEnumerable <AlbumsDto> > GetAlbums(Guid bandId)
        {
            var albumsFromRepo = _bandAlbumRepository.GetAlbums(bandId);

            return(Ok(_mapper.Map <IEnumerable <AlbumsDto> >(albumsFromRepo)));
        }