Esempio n. 1
0
        public async Task <IActionResult> CreateOrderAsync([FromBody] OrderContract order)
        {
            try
            {
                var rawOrder = CreateOrderMessage(order);

                await ProcessNewOrderAsync(rawOrder);

                telemetryProvider.LogEvent("Order Created");

                return(Ok(order));
            }
            catch (KeyVaultErrorException keyVaultException)
            {
                if (keyVaultException.Message.Contains("Secret not found:"))
                {
                    return(NotFound("Secret not found"));
                }

                throw;
            }
            catch (Exception exception)
            {
                telemetryProvider.LogException(exception);
                return(StatusCode((int)HttpStatusCode.InternalServerError, "We were unable to process your request"));
            }
        }