title: Unable to edit the user information in mvc
body: <p>Here is my problem , So i wanted to only allowing the user to change/edit their password and username only.<br>
  My original model for customer is this</p>
  <pre><code>public string IC { get; set; }
  public string FirstName { get; set; }
  public string LastName { get; set; }
  public string Username{ get; set; }
  public string Password{ get; set; }
  </code></pre>
  <p>And this is my VM for the customer</p>
  <pre><code>public string Username{ get; set; }
  public string Password{ get; set; }
  </code></pre>
  <p>And this is my controller for the edit function</p>
  <pre><code>public ActionResult Edit([Bind(Include = &quot;Username,Password&quot;)] CustomersVM customersVM )
          {
              if (ModelState.IsValid)
              {
                  db.Entry(customersVM ).State = EntityState.Modified;
                  db.SaveChanges();
                  return RedirectToAction(&quot;Index&quot;);
              }
              return View(customersVM );
          }
  </code></pre>
  <p>view.cshtml</p>
  <pre><code>@Html.ValidationSummary(true, &quot;&quot;, new { @class = &quot;text-danger&quot; })
          @Html.HiddenFor(model =&gt; model.IC)
  &lt;div class=&quot;form-group&quot;&gt;
              @Html.LabelFor(model =&gt; model.Username, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })
              &lt;div class=&quot;col-md-10&quot;&gt;
                  @Html.EditorFor(model =&gt; model.Username, new { htmlAttributes = new { @class = &quot;form-control&quot; } })
                  @Html.ValidationMessageFor(model =&gt; model.Username, &quot;&quot;, new { @class = &quot;text-danger&quot; })
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
              @Html.LabelFor(model =&gt; model.Password, htmlAttributes: new { @class = &quot;control-label col-md-2&quot; })
              &lt;div class=&quot;col-md-10&quot;&gt;
                  @Html.EditorFor(model =&gt; model.Password, new { htmlAttributes = new { @class = &quot;form-control&quot; } })
                  @Html.ValidationMessageFor(model =&gt; model.Password, &quot;&quot;, new { @class = &quot;text-danger&quot; })
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  <p>So this VM is to let the ModelState goes valid, which is will going right into the database but it turn out to turn this type of error</p>
  <blockquote>
  <p>System.InvalidOperationException: 'The entity type CustomerVM is not part of the model for the current context.'</p>
  </blockquote>