title: How to allow the admin to reset a user password to null in MVC
body: <p>How can I change the user password to <code>null</code> from admin page using user id`?</p>
  
  <p>I have this code in the login model:</p>
  
  <pre><code>public string userId { get; set; }
  public string userPassword { get; set; }
  public string userName { get; set; }
  </code></pre>
  
  <p>And in the reset model:</p>
  
  <pre><code>public string userId{ get; set; }
  [Compare("userId", ErrorMessage = "not matched")]
  public string confirmId{ get; set; }
  </code></pre>
  
  <p>In the controller:</p>
  
  <pre><code>public ActionResult reset([Bind(Include = "userId,confirmId")] Login model1, reset model2) { 
      bool userExist = dbcontext.Login.Any(contact =&gt; contact.userId.Equals(model2.userId));
      if (contactExists &amp;&amp; model2.userId==model2.confirmId) {
          dbcontext.Entry(model1).Property(x =&gt; x.LoginPassword).IsModified = true;
          dbcontext.Entry(model1).Property(x =&gt; x.Item1.EmployeeName).IsModified = false;
          dbcontext.Entry(model1).State = EntityState.Modified;
          dbcontext.SaveChanges();
      }
  }
  </code></pre>
  
  <p>In the view I have this code:</p>
  
  <pre><code>@model BSR.Models.reset
  @using (Html.BeginForm()) {
      textbox for userId
      textbox for confirmId
      submitt button
  }
  </code></pre>
  
  <p>I tried to assign <code>null</code> to <code>userPassword</code> but it didn't accept <code>null</code> in the database table. I allowed it to be <code>null</code>, what should I write to change the <code>userPassowrd</code> to <code>null</code> and leave the rest fields in the row as they are, unchanged?</p>