Watch video

What is a model?

A model is basically a class with properties. It defines the data that will later be submitted via our form and it also defines how this data will be validated.

The data that you will define in the model is the data that will be passed between the view and the controller.

Properties, or Property Types, are used to define the data in a model. Most commonly used is the `string` type, which is essentially a string of text or other characters.

You will be building the model based on the properties on the Article Document Type as well as the fields in the submission form.


The model will also contain the first level of validation.

You will decide which of the properties in the model should be required in order for the model to be valid.

For this, you will use the Required attribute. Should the model contain data for all the properties marked as required, the state of the model will be considered valid.




Check out the resources below to learn more about MVC and MVC in Umbraco.

Template project and ModelsBuilder

In the template project, the ModelBuilder is enabled. The project is configured to use the `LiveAppData` ModelBuilder mode.

The project is also configured to store all PublishedModels - the models generated automatically by Umbraco, in a folder called "PublishedModels".

If you're using your own project to run through this chapter, make sure to use the same or similar ModelsBuilder configuration.

    <add key="Umbraco.ModelsBuilder.Enable" value="true" />
    <add key="Umbraco.ModelsBuilder.ModelsMode" value="LiveAppData" />
    <add key="Umbraco.ModelsBuilder.ModelsDirectory" value="~/PublishedModels" />
    <add key="Umbraco.ModelsBuilder.AcceptUnsafeModelsDirectory" value="true" />

Project login details

Password: 1234567890

Surface Controllers

Total Time: 01:18:05

In the Surface Controllers chapter, you will learn more about some of the key functionality in Umbraco and how you can use MVC to programmatically add content and media to your Umbraco website.