public async Task <IActionResult> GetGenre(int id, [FromQuery] bool includeAlbums,
                                                   [FromHeader(Name = "x-correlationToken")]
                                                   string correlationToken)
        {
            Guard.ForNullOrEmpty(correlationToken, "correlationToken");
            Guard.ForLessEqualZero(id, "GenreId");

            var genre = await _catalogBusinessServices.GetGenre(id, correlationToken, includeAlbums);

            return(genre == null
                ? BadRequest("Genre does not exist")
                : new ObjectResult(Mapper.MapToGenreDto(genre)));
        }
Example #2
0
        public async Task <IActionResult> GetGenre(string correlationToken, int id, [FromQuery] bool includeAlbums)
        {
            Guard.ForNullOrEmpty(correlationToken, "correlationToken");
            Guard.ForLessEqualZero(id, "GenreId");

            var genre = await _catalogBusinessServices.GetGenre(id, correlationToken, includeAlbums);

            if (genre == null)
            {
                return(new ObjectResult(genre));
            }

            return(new ObjectResult(Mapper.MapToGenreDto(genre)));
        }