用于Braintree集成的ASP.NET Core 2.0中的CreateResponse

时间:2018-03-04 03:15:29

标签: c# asp.net-core

我意识到ASP.NET Core不再具有HttpResponseMessage并且我需要返回类似

的内容
    public IActionResult Blah()
    {

        return Ok(
            myservice.function()
        );
    }

但是我正在尝试整合Braintree付款和我拥有以下代码:

        var request = new TransactionRequest
        {
            Amount = model.ChargeAmount,
            PaymentMethodNonce = model.Nonce,
            Options = new TransactionOptionsRequest
            {
                SubmitForSettlement = true
            }
        };

        Result<Transaction> result = gateway.Transaction.Sale(request);
        HttpResponseMessage response = Request.CreateResponse(result);
        return response;

如何将此转换为可与.net core 2.0一起使用的内容?

0 个答案:

没有答案