public async Task <IActionResult> Put([FromBody] MusicDtoUpdate musicDto) { // See GetAllMusic() action method above for explanation var correlationToken = CorrelationTokenManager.GenerateToken(); if (!ModelState.IsValid) { _logger.LogError(LoggingEvents.CatalogPut, $"ModelState invalid for product update. Request:{correlationToken}. Error:{ModelState.Values}"); return(BadRequest(ModelState)); } var response = await _restClient.PutAsync <MusicDtoUpdate>(ServiceEnum.Catalog, "api/Catalog", correlationToken, musicDto); if (response.Data == null) { _logger.LogError(LoggingEvents.CatalogPut, $"Could not update product:{response.ErrorMessage} for correlationToken: {correlationToken}"); return(StatusCode((int)response.HttpStatusCode, response.ErrorMessage)); } _logger.LogInformation(LoggingEvents.CatalogPut, $"Updated product for request:{correlationToken}"); return(new ObjectResult(response.Data)); }
public async Task <IActionResult> Put([FromBody] MusicDtoUpdate musicDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // Generate correlationToken var correlationToken = CorrelationTokenManager.GenerateToken(); var updatedAlbum = await _restClient.PutAsync <MusicDtoUpdate>(ServiceEnum.Catalog, $"api/Catalog/?correlationToken={correlationToken}", musicDto); return(new ObjectResult(updatedAlbum)); }