Introduction to MVC Introduction NTPCUG Tom Perkins, Ph.D.
Class Objectives Introduce you to the basics of the ASP.NET MVC 4 development platform. Develop a web site using MVC 4 Deploy the website as an Azure site in the cloud Help you to develop your development skills by using MVC 4.
PREREQUISITES Visual Studio 2012 Visual Studio Express 2012 – Available as a free download from ucts/visual-studio-express-products ucts/visual-studio-express-products
Course Plan Follow the Microsoft introductory tutorial – Available at started-with-aspnet-mvc4/intro-to-aspnet-mvc-4 started-with-aspnet-mvc4/intro-to-aspnet-mvc-4 Presentations will follow the tutorial, step-by- step Each student will develop a web site Each student will deploy the website to the Internet via the Azure cloud
Class Project Website An application to list movies Movie information stored in a database Features: – Create a movie information entity – Edit – Search database – List movies
Page to list movies …
Add, edit, delete and validate data …
Starting the project … Start Visual Studio 2012 or Visual Studio Express 2012 Select New Project from the Start Page Alternative – use Menu – Select File New Project
Start Visual Studio …
Create an ASP.NET MVC 4 Web Application Select ASP.NET MVC 4 Web application Name: MvcMovie Location: Solution: MvcMovie Hit: OK
Set up the MvcMovie Project … Select: Internet Application Leave View Engine as “Razor” Hit: OK
Your MvcMovie (Hello, World!) project has been created …
Run the preliminary project … Select: DEBUG | Start Debugging Note: F5 keyboard shortcut to start application
When “F5” is pressed … VS launches a browser Opens the application’s home page Application bar: localhost Note random port number
Your baseline MVCMovie app
Default template gives you: Home, Contact, About pages Support for Login and Register pages Links to Facebook and Twitter Explore the app, then close your browser Next: 02. Adding a controller