title: Orchard CMS - Handler doesn't update the database
body: <p>At my orchard module, everything works fine, but unfortunately the database is not updated.</p>
  
  <p>I have defined the view for the admin panel at <strong>Orchard.Web\Modules\Course\Views\EditorTemplates\Parts\Course.cshtml</strong> as bellow:</p>
  
  <pre><code>@model Course.Models.CoursePart
  
  &lt;fieldset&gt;
    &lt;legend&gt;Course Fields&lt;/legend&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Title)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Title)
      @Html.ValidationMessageFor(model =&gt; model.Title)
    &lt;/div&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Description)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Description)
      @Html.ValidationMessageFor(model =&gt; model.Description)
    &lt;/div&gt;
  
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.ImagePath)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.ImagePath)
      @Html.ValidationMessageFor(model =&gt; model.ImagePath)
    &lt;/div&gt;
  
  
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>And the driver as bellow:</p>
  
  <pre><code>public class CourseDriver : ContentPartDriver&lt;CoursePart&gt;
      {
          protected override DriverResult Display(CoursePart part,
                                          string displayType,
                                          dynamic shapeHelper)
          {
  
              return ContentShape("Parts_Course",
                  () =&gt; shapeHelper.Parts_Course(
                  Description: part.Description,
                  Title: part.Title,
                  ImagePath: part.ImagePath,
                  Area: part.Area
                  ));
          }
  
          //GET
          protected override DriverResult Editor(CoursePart part,
                                                 dynamic shapeHelper)
          {
  
              return ContentShape("Parts_Course_Edit",
                  () =&gt; shapeHelper.EditorTemplate(
                      TemplateName: "Parts/Course",
                      Model: part,
                      Prefix: Prefix));
          }
  
          //POST
          protected override DriverResult Editor(CoursePart part,
                                                 IUpdateModel updater,
                                                 dynamic shapeHelper)
          {
              updater.TryUpdateModel(part, Prefix, null, null);
              return Editor(part, shapeHelper);
          }
      }
  </code></pre>
  
  <p>And the Handler:</p>
  
  <pre><code>namespace Course.Handlers
  {
      public class CourseHandler: ContentHandler
      {
            public CourseHandler(IRepository&lt;CourseRecord&gt; repository) 
            {
                  Filters.Add(StorageFilter.For(repository));
            }
  
      }
  }
  </code></pre>
  
  <p>The migration class described bellow is at the  <strong>Orchard.Web\Modules\Course\Migrations.cs</strong> file.</p>
  
  <pre><code>namespace Course {
      public class Migrations : DataMigrationImpl {
  
          public int Create() {
              // Creating table CoursePartRecord
              SchemaBuilder.CreateTable("CourseRecord", table =&gt; table
                  .ContentPartRecord()
                  .Column("Area", DbType.String)
                  .Column("Description", DbType.String)
                  .Column("Title", DbType.String)
                  .Column("ImagePath", DbType.String)
              );
  
              //Add the AlterPartDefinition lines to the migration in order to make the part
              //attachable to any content type. 
              ContentDefinitionManager.AlterPartDefinition(
                  typeof(CoursePart).Name, cfg =&gt; cfg.Attachable());
  
              return 1;
          }
  
          public int UpdateFrom1()
          {
              ContentDefinitionManager.AlterTypeDefinition("CourseContent", cfg =&gt; cfg
                .WithPart("CommonPart")
                .WithPart("RoutePart")
                .WithPart("BodyPart")
                .WithPart("CoursePart")
                .WithPart("CommentsPart")
                .WithPart("TagsPart")
                .WithPart("LocalizationPart")
                .Creatable()
                .Indexed());
              return 2;
          }
      }
  }
  </code></pre>
  
  <p>The models are described bellow:</p>
  
  <pre><code>namespace Course.Models
  {
      public class CourseRecord : ContentPartRecord
      {
          public virtual String Area { get; set; }
  
          public virtual String Description { get; set; }
          public virtual String Title { get; set; }
  
          public virtual String ImagePath { get; set; }
  
      }
  
  
      public class CoursePart : ContentPart&lt;CourseRecord&gt;
      {
          public String Area { get; set; }
          [Required]
          public String Description { get; set; }
          [Required]
          public String Title { get; set; }
          public String ImagePath { get; set; }
      }
  }
  </code></pre>
  
  <p>I was following the steps according with the example at the orchard documentation: <a href="http://docs.orchardproject.net/Documentation/Writing-a-content-part" rel="nofollow">http://docs.orchardproject.net/Documentation/Writing-a-content-part</a>.</p>
  
  <p><strong>Problem:</strong> The database is not created or updated, every property from the record is updated with null values, the <code>repository.Table</code> in <code>CourseHandler</code> method is always returning a list.</p>
  
  <p>Best regards,
  Tito</p>