title: ASP.NET Core MVC model doesn't recognize value changes
body: <p>I'm trying to make a simple ASP.NET Core MVC application which updates / inserts / displays data from our database.
  I have models written like this (similar to the db fields):</p>
  <pre class="lang-cs prettyprint-override"><code>public class INVOICE : ModelBase
  {
      [Key]
      public decimal ID { get; set; }
      public string CONTRACTID { get; set; }
      public string ORDERID { get; set; }
      public decimal? INVOICEAMOUNT { get; set; }
      public string BARCODE { get; set; }
      ...
  }
  </code></pre>
  <p>(with some more functionality like db update / insert)</p>
  <p>I have one controller:</p>
  <pre class="lang-cs prettyprint-override"><code>public class HomeController : Controller
  {
      // GET: HomeController
      INVOICE invoice = CRUD.GetFirstOrDefault(new INVOICE(), @&quot;WHERE ID IN (75693)&quot;);
      public ActionResult Index()
      {
          return View(invoice);
      }
   
      [HttpPost]
      public bool Update()
      {
          return invoice.Update();
      }
  }
  
  </code></pre>
  <p>And the <code>Index.cshtml</code>:</p>
  <pre><code>&lt;body&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Barcode&lt;/label&gt;
          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;BARCODE&quot; placeholder=&quot;0&quot; value=&quot;@Model.BARCODE&quot; readonly&gt;
      &lt;/div&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;Id&lt;/label&gt;
          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;ID&quot; placeholder=&quot;0&quot; value=&quot;@Model.ID&quot; readonly&gt;
      &lt;/div&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label&gt;INVOICEAMOUNT&lt;/label&gt;
          &lt;input type=&quot;text&quot; class=&quot;form-control&quot;  name=&quot;INVOICEAMOUNT&quot;  id=&quot;INVOICEAMOUNT&quot; value=&quot;@Model.INVOICEAMOUNT&quot; aria-describedby=&quot;emailHelp&quot; placeholder=&quot;0&quot;&gt;
      &lt;/div&gt;
  
      &lt;form id=&quot;formUpdate&quot;&gt;
          &lt;div&gt;
              &lt;asp:button id=&quot;Button&quot; class=&quot;btn btn-primary&quot;&gt;Update&lt;/asp:button&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  
      @section Scripts{
          &lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&quot;&gt;&lt;/script&gt;      
  
          &lt;script&gt;
                  $(function () {
                      $(&quot;#Button&quot;).click(function () {
                          $.ajax({
                              type: &quot;POST&quot;,
                              url: &quot;/Home/Update&quot;,
  
                              success: function (response) {
                                  console.log(response);
                              },
                              failure: function (response) {
                                  alert(&quot;Fail&quot;);
                              },
                              error: function (response) {
                                  alert(&quot;error&quot;);
                              }
                          });
                      });
                  });
          &lt;/script&gt;        
      }
  &lt;/body&gt;
  </code></pre>
  <p>But now, when I'm clicking the button after I changed the Inputfield value of the <code>INVOICEAMOUNT</code>, the update is called and successful, but the values are the same as they where when I initialized the model.
  How do I tell my model that the values got changed?</p>
  <p><strong>Edit:</strong>
  My wording is bad.
  The Update is working, but the update isn't using the values that are displayed in the view. It's still using the values I initialized, even though I changed the input field values (clicked in it, wrote a new number).</p>