title: Save changes in database controller class asp.net mvc5 identity
body: <p>Visual Studio 2013, ASP.NEt MVC 5 Identity
  Please someone help me in how to save the information in the database through controller. Let me explain...I want the following to happen:
   The user when logged is able update his Education information. After making changes in the fields, he will press the save button and the information is saved in the database. This works fine when i am doing so with the default aspnet users class, i take the usermanager. update method and the info is saved, but i am unable to do so with for any other table. I would be really thankful if someone helps me.
  Here's the controller class edit method</p>
  
  <pre><code>   public async Task&lt;ActionResult&gt; Edit(string id, Education education)
      {
  
          if (!User.Identity.IsAuthenticated)
          {
              Response.Redirect("~/Account/Login");
          }
  
          var db = new ApplicationDbContext();
          var educationdb = db.Edu.First(u =&gt; u.EducationID == education.EducationID);
  
          educationdb.Qualification = education.Qualification;
          educationdb.School = education.School;
          educationdb.SchFrom = education.SchFrom;
          educationdb.SchTo = education.SchTo;
          educationdb.College = education.College;
          educationdb.ClgFrom = education.ClgFrom;
          educationdb.ClgTo = education.ClgTo;
          educationdb.University = education.University;
          educationdb.UniFrom = education.UniTo;
          educationdb.Description = education.Description;
  
  
          db.Entry(educationdb).State = System.Data.Entity.EntityState.Modified;
          await db.SaveChangesAsync();
          //return RedirectToAction("Index");
          return View();
      }
  </code></pre>
  
  <p>this is the model class:</p>
  
  <pre><code>namespace theme1.Models
  {
  public class Education
  {
      public string EducationID { get; set; }
  
      public string UserID { get; set; }
      public ApplicationUser User { get; set; }
  
      public string Qualification { get; set; }
  
      public string School { get; set; }
      [DataType(DataType.Date)]
      public DateTime SchFrom { get; set; }
      [DataType(DataType.Date)]
      public DateTime SchTo { get; set; }
  
      public string College { get; set; }
      [DataType(DataType.Date)]
      public DateTime ClgFrom { get; set; }
      [DataType(DataType.Date)]
      public DateTime ClgTo { get; set; }
  
      public string University { get; set; }
      [DataType(DataType.Date)]
      public DateTime UniFrom { get; set; }
      [DataType(DataType.Date)]
      public DateTime UniTo { get; set; }
  
      public string Description { get; set; }
   }
  }
  </code></pre>
  
  <p>var educationdb = db.Edu.First(u => u.EducationID == education.EducationID);  this line gives me an error Exception Details: System.InvalidOperationException: Sequence contains no elements</p>
  
  <p>Source Error: 
  Line 109:            var educationdb = db.Edu.First(u => u.EducationID == education.EducationID);</p>