Saving data on postback in Orchard

Topics: Customizing Orchard
Jun 8 at 10:09 PM
I'm an Orchard newbie and I'm having difficulty trying to get the form data when a new item is created.

What I have is a module that creates a menu item on the admin dashboard. That menu item will load a page where a user can enter a new "Coach".

There are 3 things needed for a coach, first name, last name and email.

Here's the code I have implemented for this...


public class SDSDataMigration : DataMigrationImpl

    public int Create()
        SchemaBuilder..CreateTable("CoachPartRecord", table => table.ContentPartRecord()
.Column("FirstName", DbType.AnsiString, c => c.WithLength(50))                                                                                   
.Column("LastName", DbType.AnsiString, c => c.WithLength(50))                                                                         
.Column("Email", DbType.AnsiString, c => c.WithLength(200)))

        ContentDefinitionManager.AlterPartDefinition("CoachPart", part => part
                                                                          .WithField("FirstName", f => f.OfType("TextField"))
                                                                          .WithField("LastName", f => f.OfType("TextField"))
                                                                          .WithField("Email", f => f.OfType("TextField"))

        ContentDefinitionManager.AlterTypeDefinition("Coach", type => type.WithPart("CommonPart")

        return 1;

public class CoachPartRecord : ContentPartRecord
    public virtual string FirstName { get; set; }
    public virtual string LastName { get; set; }
    public virtual string Email { get; set; }

public class CoachPart : ContentPart<CoachPartRecord>
    public string FirstName
        get { return Record.FirstName; }
        set { Record.FirstName = value; }

    public string LastName
        get { return Record.LastName; }
        set { Record.LastName = value; }

    public string Email
        get { return Record.Email; }
        set { Record.Email = value; }
view for creating editor
@{ Layout.Title = T("Add Coach").ToString(); }
@using (Html.BeginFormAntiForgeryPost()) {
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type

public class CoachPartHandler : ContentHandler
    public CoachPartHandler(IRepository<CoachPartRecord> repository)
protected override DriverResult Editor(CoachPart part, IUpdateModel updater, dynamic shapeHelper)
        updater.TryUpdateModel(part, Prefix, null, null);
        return Editor(part, shapeHelper);
controller (for dashboard menu item)
public ActionResult Create()
        var coach = _services.ContentManager.New("Coach");
        var model = _services.ContentManager.BuildEditor(coach);
        return View(model);

    [HttpPost, ActionName("Create")]
    public ActionResult CreatePOST()
        var contentItem = _services.ContentManager.New("Coach");

        return View("Index");
Right now I can get the form to appear to create a new coach. When I hit "Publish" all of the fields (i.e. FirstName, LastName, Email) for the CoachPart parameter in the driver are null.

I can look at the http request and I can see the values I put on the form, but they're not making it to the CoachPart.

Any ideas why the CoachPart fields aren't getting filed in?