title: Save list to database entity framework
body: <p>I have the following code:</p>
  
  <pre><code> internal static bool SaveUOSChangeLog(List&lt;Contracts.DataContracts.UOSChangeLog&gt; values, string user)
      {
          try
          {
              using(var ctx = new StradaDataReviewContext2())
              {
                  values.ForEach(u =&gt; { u.Username = user; u.Changed = DateTime.Now; });
                  var test = ctx.UOSChangeLog.Add(values);
                  ctx.SaveChanges();
                  return true;
              }
          }
  </code></pre>
  
  <p>The thing I want to do Is to save <code>values</code> to the database. However, I get a the following error message:</p>
  
  <p><a href="https://i.stack.imgur.com/Bd5cb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Bd5cb.png" alt="enter image description here"></a></p>
  
  <p>Here is my Contracts.DataContracts.UOSChangeLog:</p>
  
  <pre><code>   public int? Id { get; set; }
          public int Accident_nr { get; set; }
          public int Refnr { get; set; }
          public int Action { get; set; }
          public string Old_data { get; set; }
          public string New_data { get; set; }
          public DateTime SearchedFromDate { get; set; }
          public DateTime SearchedToDate { get; set; }
          public DateTime Changed { get; set; }
          public string Username { get; set; }
          public string Comment { get; set; }
  </code></pre>
  
  <p>And here Is my Services.StradaDataReview2Model.UOSChangeLog that are used as a <code>DbSet</code></p>
  
  <pre><code>[Table("UOSChangeLog")]
      public partial class UOSChangeLog
      {
          [Required]
          public int? Id { get; set; }
  
          public int Accident_nr { get; set; }
          [Required]
          public int Refnr { get; set; }
          [Required]
          public int Action { get; set; }
          [Required]
          public string Old_data { get; set; }
          [Required]
          public string New_data { get; set; }
          [Required]
          public DateTime SearchedFromDate { get; set; }
          [Required]
          public DateTime SearchedToDate { get; set; }
          [Required]
          public DateTime Changed { get; set; }
          [Required]
          public string Username { get; set; }
          [Required]
          public string Comment { get; set; }
      }
  </code></pre>