ошибка: не удалось загрузить ресурс: сервер ответил со статусом 500 (Внутренняя ошибка сервера в asp.net - PullRequest
0 голосов
/ 25 ноября 2018

что не так: ajax code.Getting error

Не удалось загрузить ресурс: сервер ответил со статусом 500 (Внутренняя ошибка сервера)

iдействительно искал, может выяснить, что не так.со второй попытки, ничего не меняя, я получаю эту ошибку

POST http://localhost:51477/Customers/SaveCustomer 500 (внутренняя ошибка сервера)

   $(document).ready(function () {
      $("#btnSave").click(function () {

        var data = JSON.stringify({
            _id: $("#Customerid").val(),
            customertype: $("#CustomerType option:selected").val(),
            pricetype: $("#Pricetype option:selected").val(),
            customername: $("#Customername").val(),
            idnumber: $("#Idnumber").val(),
            contact: $("#Contact").val(),
            location: $("#Location").val(),
            loyaltycard: $("#loyalty").val(),
            creditlimit: $("#credit").val(),
            remainingcredit: $("#credit").val()
        });

        $.ajax({
            type: "POST",
            url: "/Customers/SaveCustomer",
            data: data,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(result) {

                location.reload();
                alert(result);
            },
            error: function (result) {
                alert(result+" Error!");
            }
        });


    });
});

код вставки dapper

      [HttpPost]
      public ActionResult SaveCustomer(newCustomers customers,int _id=0)
      {

         var result = "Error! Customers Required Details Have Not Been Entered!";
          if (_id == 0)
          {

                 DapperOrm.ExcuteToSave("sp_CustomerInsertNew", new 
        DynamicParameters(new
                {
                    //custType = customers.customerType == null ? "credit" : 
        customers.customerType,
                    customertype = customers.customertype == null ? 1 : 
         customers.customertype,
                    pricetype = customers.pricetype == "" ? "retail" : 
         customers.pricetype,
                    customername = customers.customername,
                    idnumber = customers.idnumber,
                    contact = customers.contact,
                    location = customers.location,
                    loyaltycard = customers.loyaltycard,
                    creditlimit = customers.creditlimit == null ? 0 : 
     customers.creditlimit,
                    remainingcredit = customers.creditlimit == null ? 0 : 
     customers.creditlimit
                   }));


          }
       return Json(result, JsonRequestBehavior.AllowGet);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...