コード例 #1
0
        public async Task <ActionResult> DeleteLineItemAsync([Required] string contextId, [Required] string lineItemId)
        {
            try
            {
                _logger.LogDebug($"Entering {nameof(DeleteLineItemAsync)}.");

                try
                {
                    var request = new DeleteLineItemRequest(contextId, lineItemId);
                    return(await OnDeleteLineItemAsync(request).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, $"An unexpected error occurred in {nameof(DeleteLineItemAsync)}.");
                    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($"Entering {nameof(DeleteLineItemAsync)}.");
            }
        }
コード例 #2
0
 /// <summary>
 /// Deletes a line item.
 /// </summary>
 /// <param name="request">The request parameters.</param>
 /// <returns>The result.</returns>
 protected abstract Task <ActionResult> OnDeleteLineItemAsync(DeleteLineItemRequest request);