title: public HttpResponseMessage Post([FromBody]product pro)
body: <p>I have this controller which I have Post Method.. but this method doesn't insert the value in database.. I can't resolve this.. need help</p>
  
  <pre><code>public HttpResponseMessage Post([FromBody]product pro)
  {
          try
          {
              using (project_smartEntities entities = new project_smartEntities())
              {
                  entities.products.Add(pro);
                  entities.SaveChanges();
  
  
                  var message = Request.CreateResponse(HttpStatusCode.Created, pro);
                  message.Headers.Location = new Uri(Request.RequestUri + pro.product_id.ToString());
                  return message;
              }
  
          }
  
          catch (Exception ex)
          {
              return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
          }
  }
  </code></pre>
  
  <blockquote>
    <p>Host: localhost:52442 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64;
    rv:53.0) Gecko/20100101 Firefox/53.0 Accept: application/json
    Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate
    Connection: keep-alive Upgrade-Insecure-Requests: 1 Content-Type:
    application/json</p>
  </blockquote>
  
  <p>I want to insert these values in my product table</p>
  
  <blockquote>
    <p>{"product_name":Maria
    B","barcode":123456789,"expiry_dates":"2022-05-12T00:00:00","unit":"3pc","tax":500.0,"cost":8000.0,"size":"Medium","quantity":2,"category_id":7,"locations":[],"product_category":null,"purchase_line":[],"sales_line":[]}</p>
  </blockquote>