ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
1. ASP.NET MVC 5: Building Your First
Web Application (A Beginnerâs Guide)
This free book is provided by courtesy of C# Corner and Mindcracker Network and
its authors. Feel free to share this book with your friends and co-workers. Please do
not reproduce, republish, edit or copy this book.
Vincent Maverick
(C# Corner MVP)
2. About Author
Vincent Maverick is a Microsoft ASP.NET MVP since 2009, C# Corner MVP and DZone MVB.
He works as a Technical Lead Developer in a research and development company. He works on
ASP.NET, C#, MS SQL, Entity Framework, LINQ, AJAX, JavaScript, JQuery, HTML5, CSS, and
other technologies.
Vincent Maverick
3. INDEX Page no
ï· Introduction 1
ï· Prerequisites 1
ï· Environment Settings and Tools Used 2
ï· Getting Started 2
ï· Brief Overview of ASP.NET MVC 2-5
o What is ASP.NET MVC?
o What are Models?
o What are Controllers?
o What are Views?
ï· Creating a Database 5
ï· Creating Database Tables 6-7
ï· Adding a New ASP.NET MVC 5 Project 8-10
ï· Setting Up the Data Access using Entity 10-16
Framework Database-First approach
o Creating the Entity Models
ï· Creating a Signup Page 16-29
o Adding ViewModels
o Adding the Controllers
o Adding the Views
o Running the Application
ï· Creating the Login Page 29-38
o Forms Authentication Overview
o Enabling Forms Authentication
o Adding the UserLoginView Model
o Adding the GetUserPassword() Method
o Adding the Login Action Method
o Adding the Login View
o Implementing the Logout Functionality
o Running the Application
4. ï· Implementing a Simple Role-Based Page Authorization 39-43
o Creating the IsUserInRole() Method
o Creating a Custom Authorization Attribute Filter
o Adding the AdminOnly and UnAuthorized page
o Adding Test Roles Data
o Running the Application
ï· Implementing Fetch, Edit, Update and Delete Operations 44-64
o Fetching and Displaying Data
ï§ Adding the View Models
ï§ Adding the ManageUserPartial Action Method
ï§ Adding the ManageUserPartial PartialView
ï§ Running the Application
o Editing and Updating the Data
ï§ Installing jQuery and jQueryUI
ï§ Adding the UpdateUserAccount() Method
ï§ Adding the UpdateUserData() Action Method
ï§ Modifying the UserManagePartial View
ï§ Integrating jQuery and jQuery AJAX
ï§ Modifying the UserManagePartial Action Method
ï§ Displaying the Status Result
ï§ Running the Application
o Deleting Data
ï§ Adding the DeleteUser() Method
ï§ Adding the DeleteUser() Action Method
ï§ Integrating jQuery and jQuery AJAX
ï§ Running the Application
ï· Creating a User Profile Page 64-70
o Adding the GetUserProfile() Method
o Adding the EditProfile() Action Method
o Adding the View
o Running the Application
5. ï· Implementing a ShoutBox Feature 71-78
o Creating the Message Table
o Updating the Entity Data Model
o Updating the UserModel
o Updating the UserManager Class
o Updating the HomeController Class
o Creating the ShoutBoxPartial Partial View
o Down to the JavaScript Functions
o Wrapping Up
o Running the Application
ï· Deploying Your ASP.NET MVC 5 App to IIS8 79-100
o Overview of IIS Express and IIS Web Server
o Installing IIS8 on Windows 8.1
o Publishing from Visual Studio
o Converting Your App to Web Application
o Enable File Sharing in IIS
o Configuring SQL Server Logins
o Configuring Application Poolâs Identity
o Running the Application
ï· Summary 101