I want to update the row but when I click the update buttton return json result that message "500 Internenal Server Error". I don't find the problem. Can you check the code?

```
[HttpPost]
    public JsonResult UpdateInStock(int stokID, int amount, int uCost, int sumCost, string detail, string unit)
    {
        var model = db.tbl_InStock.Where(x => x.stockInID == stokID).FirstOrDefault();
        model.stockInAmount = amount;
        model.stockInCost = uCost;
        model.stockInSum = sumCost;
        model.stockInDetail = detail;
        model.stockInUnit = unit;
        //db.SaveChanges();

        return Json(new { result = "Redirect", url = Url.Action("Gelen", "Anasayfa") });
    }

```

I want to update the row but when I click the update buttton return json result that message "500 Internenal Server Error". I don't find the problem. Can you check the code?

```js
//Jquery Code
$("#uptInStock").click(function () {
        var no = $.trim($("#stokInIDD").val());
        var miktar = $.trim($("#amountt").val());
        var fiyat = $.trim($("#unitCostt").val());
        var toplam = $.trim($("#sumCostt").val());
        var detay = $.trim($("#detaill").val());
        var birim = $.trim($("#birimm option:selected").text());
        var obj = { stokID: no, amount: miktar, uCost: fiyat, sumCost: toplam, detail: detay, unit: birim };
        $.ajax({
            type: "POST",
            url: 'UpdateInStock',
            crossDomain: true,
            data: JSON.stringify(obj),
            contentType: 'application/json;charset=utf-8"',
            dataType: 'json',
            success: function (response) {
                if (response.result == 'Redirect')
                    window.location = response.url;
                alert("Suc");
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(errorThrown);
            }
        });
    });
```

```html
//Html Code
@using (Html.BeginForm("UpdateInStock", "Anasayfa", FormMethod.Post))
            {
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">Gelen Ürün - Güncelle</h5>
                </div>
                <div class="modal-body">
                    <input type="hidden" class="form-control" id="proIDD" />
                    <input type="hidden" class="form-control" id="stokInIDD" />
                    <div class="form-group">
                        <label class="sr-only mb-4" for="inlineFormInputGroup">Miktar</label>
                        <div class="proUnit2 input-group mb-4">
                            <div class="input-group-prepend">
                                <div class="input-group-text">Miktar</div>
                            </div>
                            <input type="text" class="form-control" id="amountt" />
                        </div>
                    </div>
                    <div class="form-group">
                        <select class="form-control mb-4" id="birimm" name="birim">
                            <option value="0">Birim Seçiniz</option>
                            <option value="1">Adet</option>
                            <option value="2">Bidon</option>
                            <option value="3">Koli</option>
                            <option value="4">Paket</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label class="sr-only mb-4" for="inlineFormInputGroup">Birim Fiyatı</label>
                        <div class="proUnit input-group mb-4">
                            <div class="input-group-prepend">
                                <div class="input-group-text"><i class="fa fa-try" aria-hidden="true"></i></div>
                            </div>
                            <input type="text" class="form-control" id="unitCostt" placeholder="Birim fiyatı" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="sr-only mb-4" for="inlineFormInputGroup">Toplam Fiyatı</label>
                        <div class="proUnit input-group mb-4">
                            <div class="input-group-prepend">
                                <div class="input-group-text"><i class="fa fa-try" aria-hidden="true"></i></div>
                            </div>
                            <input type="text" class="form-control" id="sumCostt" placeholder="Toplam fiyatı" />
                        </div>
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" id="detaill" placeholder="Açıklama" />
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Vazgeç</button>
                    <button id="uptInStock" type="button" class="btn btn-primary btn-sm">Kaydet</button>
                </div>
            }
```