public async Task <IActionResult> Get(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(BadRequest());
            }

            GetPayment result;

            using (var operation = _telemetrySubmitter.BeginTimedOperation(new ServiceOperation(nameof(PaymentsController), nameof(Get))))
            {
                try
                {
                    result = await _paymentManager.GetByIdAsync(id);
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Failed to Get payment Id: {0} due to {1}", id, ex.Message);
                    operation.SetFaulted(ex);
                    throw;
                }
            }

            if (result == null)
            {
                return(NotFound());
            }

            return(Ok(result));
        }
Ejemplo n.º 2
0
 public async Task <ActionResult <Payment> > GetAsync(
     Guid id, CancellationToken cancellationToken)
 {
     return(Ok(await _paymentManager.GetByIdAsync(id, cancellationToken)));
 }