From the course: Learning ASP.NET

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Work with models and forms

Work with models and forms

From the course: Learning ASP.NET

Start my 1-month free trial

Work with models and forms

- [Instructor] We'll continue to implement course management while covering MVC topics like model validation and binding. Open the Course Controller, and go to the Create action on line 31 that accepts HTTP POST requests. It'll be passed form values for adding a new course. Right-click the action, and select Add View. The view name is already filled in to match the action's name. For the template, choose Create. This'll give us boilerplate code and markup for creating courses. In the model class dropdown, choose the course model that we created earlier, and click Add. Notice the first line in the view, it's a model declaration. It means that our view is strongly typed to the course class. The Razor view engine can use the course object that was passed and access its properties. If we scroll through the view, we'll see code blocks with methods that begin with HTML. These are HTML helper methods that are available to help us with common tasks. HTML.BeginForm on line nine will write out…

Contents