Buy the Book
This NerdDinner tutorial is chapter 1 of the new Professional ASP.NET MVC 1.0 book from Wrox Press.
You can read the rest of the book to learn even more about ASP.NET MVC.
Subscribe to My Blog
You can learn more about .NET, ASP.NET and Silverlight from my blog: http://weblogs.asp.net/scottgu
The best way to learn a new framework is tobuild something with it. This tutorial walks through how to build a small, but complete, application using ASP.NET MVC, and introduces some of the core concepts behind it.
The application we are going to build is called "NerdDinner". NerdDinner provides an easy way for people to find and organize dinners online:
NerdDinner enables registered users to create, edit and delete dinners. It enforcesa consistent set of validation and business rules across the application:
Visitors can use an AJAX-based map to search for upcoming dinners being held near them:
Clicking a dinner will take them to a details page where they can learn more about it:
If they are interested in attending the dinner they can login or register on the site:
They can then click an AJAX-based RSVP link toattend the event:
We are going to begin our NerdDinner application by using the File->New Project command within Visual Studio to create a brand new ASP.NET MVC project. We will then incrementally add functionality and features. Along the way we'll cover:
1. How to create a new ASP.NET MVC Project
2. How to create a database
3. How to build a model withbusiness rule validations
4. How to use controllers and views to implement a listing/details UI
5. How to provide CRUD (create, read, update, delete) data form entry support
6. How to use ViewData and implement ViewModel classes
7. How to re-use UI using master pages and partials
8. How to implement efficient data paging
9. How to secure applications using authenticationand authorization
10. How to use AJAX to deliver dynamic updates
11. How to use AJAX to implement mapping scenarios
12. How to enable automated unit testing
You can build your own copy of NerdDinner from scratch by completing each step we walkthrough in this chapter. Alternatively, you can download a completed version of the source code here: http://nerddinner.codeplex.com/. You canalso optionally also download a free PDF version of this tutorial if you want to read the tutorial offline.
You can use either Visual Studio 2008 or the free Visual Web Developer 2008 Express to build the application. You can use either SQL Server or the free SQL Server Express for the database.
You can install ASP.NET MVC, Visual Web Developer 2008 Express, and SQL Server Express (all free)using V2 of the Microsoft Web Platform Installer
Now let's get started....
Now that we've covered what NerdDinner is, let's roll up our sleaves and write some code.
We'll begin by using File->New Project within Visual Studio to create the NerdDinner application.
NerdDinner Step 1: File->New Project
[This is step 1 of a free "NerdDinner" application tutorial that walks-through how tobuild a small, but complete, web application using ASP.NET MVC.
We'll begin our NerdDinner application by selecting the File->New Project menu item within either Visual Studio 2008 or the free Visual Web Developer 2008 Express.
This will bring up the "New Project" dialog. To create a new ASP.NET MVC application, we'll select the "Web" node on the left-hand side of the dialog and then choosethe "ASP.NET MVC Web Application" project template on the right:
Important: Make sure you've downloaded and installed ASP.NET MVC - otherwise it won't show up in the New Project dialog. You can use V2 of the Microsoft Web Platform Installer if you haven't installed it yet (ASP.NET MVC is available within the "Web Platform->Frameworks and Runtimes" section).
We'll name the new project we...