javascript – Error with get in ajax

Hello good day I hope you can help me with this problem.

I have this request in ajax

function getEditSaleDetails(id){
$.ajax({
    url: '../../SaleDetails/Edit/' + id,
    type: "GET",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (data) {
        if (!data) {
            alert('El producto no existe' + id);
        }
        else {
            console.log(data(0).Id);
        }
    },
    error: function () {

    }
});

}

In which it reaches my controller:

(HttpGet)
    public async Task Edit(int? id)
    {
        if (id == null)
        {
            return Json(false, JsonRequestBehavior.AllowGet);
        }
        SaleDetail saleDetail = await db.SaleDetails.FindAsync(id);
        if (saleDetail == null)
        {
            return Json(false, JsonRequestBehavior.AllowGet);
        }
        return Json(saleDetail, JsonRequestBehavior.AllowGet);
    }

And my error is when I want to see the result of my query in the console it tells me that I have an error 500 but when the value is false it validates it without any problem.