I confused after hours because I have an issue about getting null model in my api in a project same as another one that everything is ok in it!

About issue


var data = new FormData(),
    firstName = $('#FirstName').val(),
    lastName = $('#LastName').val();
data.append("FirstName", firstName);
data.append("LastName", lastName);

        var ajaxRequest = $.ajax({
            type: "POST",
            url: "/api/CRUD/AddPatient",
            contentType: "application/json",
            processData: false,
            data: data,
            success: function (xhr, data) {
            error: function (xhr, ajaxOptions, thrownError) {
                //handle error


    public string AddPatient(PatientBindingModel model)
            PatientStore ps = new PatientStore();

            string ticks = DateTime.Now.Ticks.ToString();


            return "success";
        catch (Exception ex)
            string exMessage = ex.Message;
            return exMessage;

And the model passed into api controller is null at all!

Anyone have any idea? Thanks

0 Answers 11

Not the answer you're looking for? Browse other questions tagged or ask your own question.