ASP.NET MVC 5 and Web API

MVC, Web API and the Entity Framework is a very complete set of tools built by Microsoft to allow you to quickly create multi-tiered modern web applications. ASP NET MVC 5 and Web API is a five-day instructor-led course is a deep dive into MVC and covers not only Models, Views and Controllers, but also covers ASP.NET Routing, Web API, REST, OData and the Entity Framework. You will get hands on with guided labs that reinforce the lecture material.

Retail Price: $2,500.00

Next Date: 01/14/2019

Course Days: 5


Enroll in Next Date

Request Custom Course


Audience Profile

This class is for new web site developers needing to learn the full MVC collection of features and for experienced developers new to ASP.NET MVC.

At Course Completion

Key ASP NET MVC 5 and Web API Takeaways:

You will learn to:

  • Understand the role of URL Routing in MVC and Web API.
  • Understand the roles of Controllers, Models and Views.
  • Create beginning to end MVC applications.
  • Work with the Entity Framework.
  • Create Views using HTML, CSS, Razor and Bootstrap.js.
  • Create and consume Web API and REST/OData web services.

 

Prerequisites

  • Strong skills in C#.
  • Good HTML5 and CSS3 skills.
  • An understanding of how mobile devices impact your web projects.
  • Basic SQL Server experience.

Module 1:  A Brief History of HTML, MVC and the Web

This module builds a base for the rest of the course and covers the history and uses of MVC, important terminology and an overview of the tools and templates used to build MVC applications.

Lessons

  • MVC Versions
  • What is MVC?
  • MVC and “Auto-Magic”
  • Creating a New MVC Project
  • A Few Notes About Databases for Developers
  • C# and Visual Studio Notes and Tips

Lab 1:  MVC

  • Q&A quiz
  • Create an MVC Project

After completing this module you will be able to:

  • Describe the key features and use of MVC.
  • Explain the history and versions of MVC.
  • Create a simple MVC project.

Module 2:  Routing

MVC URLs don’t point to pages or files, they point to controllers. Or rather, they are routed to controllers. In this module we will see how routing gives you the flexibility to later restructure your application without breaking existing URLs and separates site navigation from the Models, Controllers and Views.

Lessons

  • The Routes Collection
  • Debugging Routes
  • Adding Routes
  • Web API Routes
  • Page Routes
  • MVC Routes
  • Attribute Based Routes
  • Routes and Parameters
  • Ignored Routes
  • Routing Order

Lab 2: Explore MVC Default and Custom Routing

  • Q&A quiz
  • Explore the Sample Project
  • Test the Default Routes
  • Add a Custom Route for a Legacy Page
  • Add a Custom Route for the About Page
  • Add a Custom Route to Lookup Customers

After completing this module you will be able to:

  • Explain the types and uses of ASP.NET Routing.
  • Understand the default MVC routing.
  • Add custom routes for legacy pages, and MVC controllers and actions.

Module 3:  Controllers and Actions

Controllers are the heart of MVC. User requests are routed to Controllers, Controllers access models, Controllers apply business logic, Controllers pass the data to Views and then the HTML generated by the View is returned to the user. In this module we will create controller classes and write action methods.

Lessons

  • Controllers
  • Creating Controller Classes
  • Actions
  • Creating Actions
  • Common Issues for Actions
  • Working with Parameters
  • Action Attributes
  • Restricting Access to Actions and Controllers
  • Improving Performance with Caching
  • Dealing with Controller and Action Exceptions
  • Passing Data to Views
  • Action Filters
  • Best Practices

Lab 1:  Controllers and Actions

  • Q&A quiz
  • Add Controllers
  • Control Access to Controllers and Actions

After completing this module you will be able to:

  • Plan and create controller classes.
  • Create controller actions.
  • Handle controller and action exceptions.
  • Create routes, controllers and actions that accept parameters.
  • Use controller and action attributes.

Module 4:  Entity Framework

This module provides an introduction to the Entity Framework to help you get started with MVC Models without having to write a lot of database code. The Entity Framework is not part of MVC or required by MVC, but is one of the quickest ways of building model classes for an MVC project.

Lessons

  • Entities?
  • Context?
  • Getting the Entity Framework
  • Resources
  • Database First, Model First and Code First
  • Core Objects
  • Database First
  • Model First
  • Code First
  • Testing with Standard Data
  • Calling SQL Through the Entity Framework Context
  • Tips, Caching, Monitoring and the Fluent API

Lab 4: Entity Framework

  • Q&A quiz
  • Create a Code First Entity Framework Application
  • Explore the Database
  • Add a Connection String

After completing this module you will be able to:

  • Describe the key features of the Entity Framework.
  • Describe the use of Code First, Model First and Data First.
  • Quickly add a SQL data tier to a .NET project.

Module 5:  Models

A Model represents the application’s data. The model typically defines the business objects as classes, retrieves and stores data to the database and maintains the model state. While the most common model framework for MVC is the Entity Framework, you can use other frameworks or create your own model code. In this module we will explore using Models and View Models to represent our data.

Lessons

  • Models
  • MVC without the Entity Framework
  • Model Tiers
  • Model Attributes
  • Display Attributes
  • Validation Attributes
  • Other Attributes
  • Additional MVC Attributes
  • View Models
  • Best Practices

Lab 5:  Models

  • Q&A quiz
  • Add Data Validation Attributes
  • Add an Entity Relationship

After completing this module you will be able to:

  • Describe Model and View Model classes.
  • Create Model classes, with and without the Entity Framework.
  • Add Display Attributes for use with Razor Views.
  • Add Validation and other Attributes.
  • Create and use View Models.

Module 6:  Views

A View Engine takes data provided by a controller and a view file and then creates the HTML to return to the user’s browser. In this module we will review the available View Engines and explore the Razor View Engine.

Lessons

  • Route to Controller to Action to View
  • View Engines
  • “Auto-magic” and Views
  • Controller Helpers for Views
  • Passing Data to Views
  • View Bags
  • “Model.” vs. “model.” vs. “@model”
  • Razor
  • HTML, CSS and Razor Views
  • Creating Razor Views
  • Embedded Razor Code
  • Razor HTML Helpers
  • HTML Helpers for Forms
  • Mobile-Specific Views
  • Layouts
  • Partial Views
  • Best Practices

Lab 6:  Views

  • Q&A quiz
  • Review the Project
  • Format the Product List
  • Highlight Items That Need to be Reordered
  • Add a Partial View for Products
  • Add a Data Driven Dropdown List
  • Validate the HTML
  • Optional – Add a Sortable Grid

After completing this module you will be able to:

  • Q&A quiz
  • Review the Project
  • Format the Product List
  • Highlight Items That Need to be Reordered
  • Add a Partial View for Products
  • Add a Data Driven Dropdown List
  • Validate the HTML
  • Optional – Add a Sortable Grid

Module 7:

Larger projects tend to have separate areas of responsibility, which MVC supports as Models, Views and Controllers. As applications grow, your Models, Views and Controllers folders will start to collect a large number of items and will become more difficult to manage. To better support larger and more complex projects MVC supports the concept of Areas to break a project into sections.

Lessons

  • Areas
  • Creating Areas
  • Linking between Areas
  • HTML Helpers

After completing this module you will be able to:

  • Describe the uses of MVC Areas.
  • Create and manage MVC Areas.
  • Use the Razor HTML ActionLink helpers to navigate between Areas.

Module 8:  Web API

In this module we will take what you already know about MVC to quickly create RESTful web services using ASP.NET Web API. Web API could even be thought of as MVC without the “V”. You still create routes, models and controllers, but instead of returning views you return data.

Lessons

  • A Brief History of Web Services
  • Add Web Services to an MVC Project
  • MVC Actions vs. Web API
  • Data Formats – XML & JSON
  • Consuming Web Services
  • Calling a Web Service from Server Side Code
  • Calling a Web Service from Ajax and jQuery
  • Starting a new Web API or MVC plus Web API Project
  • Adding Web API to an Existing MVC Project
  • Web API Routing
  • Web API Controllers
  • HTTP Verbs
  • Web API Actions
  • Returning Data – Best Practices
  • Using IHttpActionResult
  • Web API Help Pages
  • RESTful Web Services
  • OData
  • OData Queries
  • OData Updates
  • Differences Between a Web API Project and an OData Project
  • Adding REST and OData to a Project

Lab 8:  Web API and REST

  • Q&A quiz
  • Return a Simple Value
  • Return a Vendor List as JSON
  • Basic Web API
  • Web API with a Model
  • Add a Web API Help Page to Your MVC Project
  • REST and OData

After completing this module you will be able to:

  • Describe web services and ASP.NET solutions.
  • Choose between traditional ASP.NET web services, Web API and REST/OData solutions.
  • Create a Web API project.
  • Plan and navigate REST URLs.
  • Create OData queries and updates.
  • Create REST/OData web service solutions.

Module 9:  Where to Go From Here

Model View Controller (MVC) is an architectural pattern. It is a collection of tools (classes and wizards) and a pattern for software development. Your team will need to need to do some homework before starting an MVC or REST project. In this module we will take a look at what you will need to know before starting the project.

Course Dates Course Times (EST) Delivery Mode GTR
1/14/2019 - 1/18/2019 9:00 AM - 4:30 PM Virtual Enroll
2/18/2019 - 2/22/2019 9:30 AM - 5:00 PM Virtual Enroll