public async Task <IActionResult> GetAllMusic(string correlationToken) { Guard.ForNullOrEmpty(correlationToken, "correlationToken"); var albums = await _catalogBusinessServices.GetAllMusic(correlationToken); if (albums.Count < 1) { return(new ObjectResult(new List <MusicDto>())); } // ObjectResult return type is capable of content negotiation return(new ObjectResult(Mapper.MapToMusicDto(albums))); }
public async Task <IActionResult> GetAllMusic([FromHeader(Name = "x-correlationToken")] string correlationToken) { if (string.IsNullOrEmpty(correlationToken)) { return(BadRequest("CorrelationToken not present")); } var products = await _catalogBusinessServices.GetAllMusic(correlationToken); if (products == null || products.Count < 1) { return(BadRequest("Products do not exist")); } return(new ObjectResult(Mapper.MapToMusicDto(products))); }