title: update only needed field mvc EF
body: <p>My code is like this
  Model</p>
  
  <pre><code>public class Department
  {
      public int DepartmentID { get; set; }
      public string Name { get; set; }
      public bool Status { get; set; } //no appointments when false
      public DateTime CreatedDate { get; set; }
      public int CreatedUserId
      {
          get { return ((SystemUser) HttpContext.Current.Session["CurrentUser"]).SystemUserID; }
      }
  
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code> [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Edit([Bind(Include="DepartmentID,Name,CreatedUser,CreatedDate")] Department department)
      {
          if (ModelState.IsValid)
          {
              db.Entry(department).State = EntityState.Modified;
              db.SaveChanges();
              return RedirectToAction("Index");
          }
          return View(department);
      }
  </code></pre>
  
  <p>View (Edit)</p>
  
  <pre><code>    @model DiagnosisApp.Models.Department
  
  @using (Html.BeginForm())
  {
          @Html.AntiForgeryToken()
          @Html.ValidationSummary(true)
          @Html.HiddenFor(model =&gt; model.DepartmentID)
          @Html.TextBoxFor(model =&gt; model.Name, new { @class = "form-control", @placeholder = "Enter Department Name" })
          &lt;button type="submit" value="Save" &gt;Save&lt;/button&gt;
  
  }
  </code></pre>
  
  <p>As you can see in view I only want to Update the <code>Name</code> field , But when I run the code all fields in table are updated.For which columns I have not added value gets updated with null. Can anyone point out what I am doing wrong here?</p>