title: ASP.NET MVC 4 Entity Framework can not insert record
body: <p>I get the following error when I try to add a <code>Schedule</code>.</p>
  
  <blockquote>
    <p>The column name 'Doctor_id' is specified more than once in the SET clause or column list of an INSERT. A column cannot be assigned more than one value in the same clause. Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code. </p>
  </blockquote>
  
  <p>Here is my schedule model</p>
  
  <pre><code>[Table("Schedule")]
  public class Schedule
  {
      public int Id { get; set; }
      [Required]
      [DataType(DataType.Date)]
      public DateTime Date { get; set; }
      [Required]
      [DataType(DataType.Time)]
      public TimeSpan StartTime { get; set; }
      [Required]
      [DataType(DataType.Time)]
      public TimeSpan EndTime { get; set; }
      public bool Booked { get; set; }
  
      public int Doctor_id { get; set; }
      //public virtual Doctor Doctor { get; set; }
  }
  </code></pre>
  
  <p>Here is my controller: </p>
  
  <pre><code>public ActionResult CreateSchedule(Schedule schedule)
  {
      TimeSpan startTime = schedule.StartTime;
      TimeSpan endTime = schedule.EndTime;
  
      db.Schedules.Add(schedule);
      db.SaveChanges();
  }
  </code></pre>
  
  <p>This is the form</p>
  
  <pre><code>&lt;div class="form-horizontal"&gt;
      &lt;h4&gt;Schedule&lt;/h4&gt;
      &lt;hr /&gt;
      @Html.ValidationSummary(true, "", new { @class = "text-danger" })
  
      &lt;input type="hidden" name="Doctor_id" value="@Session["doctorid"]" /&gt;
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.Date, htmlAttributes: new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.EditorFor(model =&gt; model.Date, new { htmlAttributes = new { @class = "form-control date" } })
              @Html.ValidationMessageFor(model =&gt; model.Date, "", new { @class = "text-danger" })
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.StartTime, htmlAttributes: new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.EditorFor(model =&gt; model.StartTime, new { htmlAttributes = new { @class = "form-control" } })
              @Html.ValidationMessageFor(model =&gt; model.StartTime, "", new { @class = "text-danger" })
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.EndTime, htmlAttributes: new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.EditorFor(model =&gt; model.EndTime, new { htmlAttributes = new { @class = "form-control" } })
              @Html.ValidationMessageFor(model =&gt; model.EndTime, "", new { @class = "text-danger" })
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          &lt;div class="col-md-offset-2 col-md-10"&gt;
              &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have a hidden input name <code>Doctor_id</code> with value for the create form.
  Please help me with this, thanks.</p>