Ejemplo n.º 1
0
        public async Task <ActionResult <Guid> > UpdateProductDescriptionAsync(
            [FromRoute] Guid productId,
            [FromBody] string newDescription
            )
        {
            _logger.LogDebug($"Recieved product detail update request for product {productId} and description '{newDescription}'");
            var operationResult = await _databaseProxy.UpdateProductDescriptionAsync(productId, newDescription);

            if (operationResult.IsValid)
            {
                _logger.LogDebug($"Returned product detail update response for product {productId} and description '{newDescription}'");

                return(Ok());
            }

            _logger.LogDebug($"Error during product detail update for product {productId} and description '{newDescription}', error message {operationResult.ErrorMessage}, error code {operationResult.ErrorCode}");
            _logger.LogError($"Error during product detail update, error message {operationResult.ErrorMessage}, error code {operationResult.ErrorCode}");

            return(StatusCode(operationResult.ErrorCode, operationResult.ErrorMessage));
        }