コード例 #1
0
        public ActionResult <AlbumDto> GetAlbum(Guid albumId)
        {
            var album = _repository.GetAlbum(albumId);

            if (album == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <AlbumDto>(album)));
        }
コード例 #2
0
        public ActionResult <AlbumDTO> GetAlbumForBand(Guid bandId, Guid albumId)
        {
            if (!_bandAlbumRepository.BandExists(bandId))
            {
                return(NotFound());
            }
            Album album = _bandAlbumRepository.GetAlbum(bandId, albumId);

            if (album == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <Album, AlbumDTO>(album)));
        }
コード例 #3
0
        public ActionResult <AlbumDto> GetAlbum(Guid bandId, Guid albumId)
        {
            if (!_repository.BandExists(bandId))
            {
                return(NotFound());
            }
            var albumForRepo = _repository.GetAlbum(bandId, albumId);

            if (albumForRepo == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <AlbumDto>(albumForRepo)));
        }
コード例 #4
0
        public ActionResult<AlbumDto> GetAlbumForBand(Guid bandId, Guid albumId)
        {
            if (!_bandAlbumRepository.BandExists(bandId))
            {
                return NotFound();
            }

            Entities.Album album = _bandAlbumRepository.GetAlbum(bandId, albumId);

            if (album == null)
            {
                return NotFound();
            }

            return Ok(_mapper.Map<AlbumDto>(album));
        }
コード例 #5
0
        public ActionResult <AlbumDto> GetAlbumForBand(Guid bandID, Guid albumID)
        {
            if (!_bandAlbumRepository.BandExists(bandID))
            {
                return(NotFound());
            }

            var albumFromRepo = _bandAlbumRepository.GetAlbum(bandID, albumID);

            if (albumFromRepo == null)
            {
                return(NotFound());
            }

            return(new OkObjectResult(_mapper.Map <AlbumDto>(albumFromRepo)));
        }
コード例 #6
0
        public ActionResult <AlbumDto> GetAlbumForBand(Guid bandId, Guid albumId)
        {
            if (!_bandAlbumRepository.BandExists(bandId))
            {
                return(StatusCode(StatusCodes.Status404NotFound));
            }

            var albumForBand = _bandAlbumRepository.GetAlbum(bandId, albumId);

            if (albumForBand == null)
            {
                return(StatusCode(StatusCodes.Status404NotFound));
            }

            return(StatusCode(StatusCodes.Status200OK, _mapper.Map <AlbumDto>(albumForBand)));
        }
コード例 #7
0
        public async Task <ActionResult <AlbumDto> > GetAlbumForBand(Guid bandId, Guid albumId)
        {
            if (!await _bandAlbumRepository.BandExists(bandId))
            {
                return(NotFound());
            }

            //if (!_bandAlbumRepository.AlbumExists(albumId))
            //    return NotFound();

            var albumFromRepo = await _bandAlbumRepository.GetAlbum(bandId, albumId);

            if (albumFromRepo == null)
            {
                return(NotFound());
            }

            return(Ok(_mapper.Map <AlbumDto>(albumFromRepo)));
        }
コード例 #8
0
        public ActionResult <AlbumsDTO> GetAlbumForBand(Guid bandId, Guid albumId)
        {
            //if (!_bandAlbumRepository.BandExists(bandId))
            //    return NotFound();
            var albumFromRepo = _bandAlbumRepository.GetAlbum(bandId, albumId);

            if (albumFromRepo == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <AlbumsDTO>(albumFromRepo)));
        }
コード例 #9
0
 public ActionResult <AlbumDto> GetAlbumForBand(Guid bandId, Guid albumId)
 {
     if (!_bandAlbumRepository.BandExists(bandId))
     {
         var AlbumFromPro = _bandAlbumRepository.GetAlbum(bandId, albumId);
         if (AlbumFromPro != null)
         {
             return(Ok(_mapper.Map <AlbumDto>(AlbumFromPro)));
         }
         return(NotFound());
     }
     return(NotFound());
 }