Ejemplo n.º 1
0
        public async Task <ActionResult> UpdateLineItemAsync([Required] string contextId, [Required] string lineItemId, [Required] LineItem lineItem)
        {
            try
            {
                _logger.LogDebug($"Entering {nameof(UpdateLineItemAsync)}.");

                try
                {
                    var request = new UpdateLineItemRequest(contextId, lineItemId, lineItem);
                    return(await OnUpdateLineItemAsync(request).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, $"An unexpected error occurred in {nameof(OnAddLineItemAsync)}.");
                    return(StatusCode(StatusCodes.Status500InternalServerError, new ProblemDetails
                    {
                        Title = "An unexpected error occurred",
                        Status = StatusCodes.Status500InternalServerError,
                        Detail = _env.IsDevelopment()
                            ? ex.Message + ex.StackTrace
                            : ex.Message
                    }));
                }
            }
            finally
            {
                _logger.LogDebug($"Exiting {nameof(UpdateLineItemAsync)}.");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Updates a line item.
 /// </summary>
 /// <param name="request">The request parameters.</param>
 /// <returns>The result.</returns>
 protected abstract Task <ActionResult> OnUpdateLineItemAsync(UpdateLineItemRequest request);