Пример #1
0
        public async Task <IActionResult> GetArtistAlbums([FromRoute] int artistId)
        {
            try
            {
                var artist = await _artistService.GetArtistAlbumsAsync(artistId);

                if (artist == null)
                {
                    return(NotFound(new ErrorResponse(ErrorMessages.Artist.DoesNotExist)));
                }

                return(Ok(new Response <ArtistAlbumsResponse>(_mapper.Map <ArtistAlbumsResponse>(artist))));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(ErrorMessages.Artist.FailedRead)));
            }
        }