Post data with free-jqgrid, what are the code in client and Web API side?
<p>I am using ASP.NET MVC 6 Web API. In the View I use <a href="https://github.com/free-jqgrid" rel="nofollow noreferrer">free-jqgrid.</a>
Let's borrow <a href="https://jsfiddle.net/OlegKi/j3x8152m/1/" rel="nofollow noreferrer">Oleg's free jqgrid data</a> to demonstrate my purpose. We already have the table shown.</p>

<p>Next I am going to add new Vendor. Please notify that there is primary key id(identity column) in the database. We don't want it displaying in the screen.
<a href="https://i.stack.imgur.com/XnVOW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XnVOW.png" alt="newvendor"></a></p>

<p>In <code>VendorRespository.cs</code>, I add the new Vendor as</p>

<pre><code>    public void AddVendor(Vendor item)
    {
        using (VendorDataContext dataContext = new VendorDataContext())
        {
            dataContext.Database.Connection.ConnectionString = DBUtility.GetSharedConnectionString(
                "http://centralized.admin.test.com");
            var newVendor = dataContext.Vendors.Create();
            newVendor.Company = item.Company;
            newVendor.ContactName = item.ContactName;
            newVendor.ContactPhone = item.ContactName;
            newVendor.UserName = item.UserName;
            newVendor.UserKey = item.UserKey;
            newVendor.Active = item.Active;
            newVendor.FacilityId =item.FacilityId;
            newVendor.ClientID = item.ClientID;
            dataContext.SaveChanges();
        }
    }
</code></pre>

<p>My questions:</p>

<ol>
<li><p>Not sure the script like?</p>

<pre><code>&lt;script&gt;
   API_URL = "/VendorManagement/";
   function updateDialog(action) {
      return {
          url: API_URL
          , closeAfterAdd: true
          , closeAfterEdit: true
          , afterShowForm: function (formId) { }
          , modal: true
          , onclickSubmit: function (params) {
              var list = $("#jqgrid");
              var selectedRow = list.getGridParam("selrow");
              rowData = list.getRowData(selectedRow);
              params.url += rowData.Id;
              params.mtype = action;
          }
          , width: "300"
      };
  }

jQuery("#jqgrid").jqGrid('navGrid',
    { add: true, edit: true, del: true },
    updateDialog('PUT'),
    updateDialog('POST'),
    updateDialog('DELETE')
);
</code></pre>

<p></p></li>
<li><p>In the controller, not sure what is the code?</p>

<pre><code>  // POST
  public HttpResponseMessage PostVendor(Vendor item)
 {
    _vendorRespository.AddVendor(item);
    var response = Request.CreateResponse&lt;Vendor&gt;(HttpStatusCode.Created, item);
    string uri = Url.Link("DefaultApi", new { id = item.Id });
    response.Headers.Location = new Uri(uri);
    return response;
 }
</code></pre>

<p>My code has many compiling errors such as</p></li>
</ol>

<blockquote>
  <p>'HttpRequest' does not contain a definition for 'CreateResponse' and the best extension method overload 'HttpRequestMessageExtensions.CreateResponse(HttpRequestMessage, HttpStatusCode, Vendor)' requires a receiver of type 'HttpRequestMessage'</p>
</blockquote>

<p>Please help me to get rid of the error and inappropriate code. </p>

<p><strong>EDIT:</strong> </p>

<p>I borrowed the code snippet from <a href="http://techbrij.com/add-edit-delete-jqgrid-asp-net-web-api" rel="nofollow noreferrer">here.</a></p>