Duration
5 days
Overview
In this course, students will learn to develop ASP.NET MVC applications using .NET Framework on server side and using angular framework on client side. Using MVC on both server and client side allows separation of responsibilities within code which makes applications easier to maintain and also improves performance.
Objectives
In this training, attendees will learn how to:
- Define MVC on server and client side
- Create MVC and Web API applications using ASP.NET MVC on server side
- Create single page web applications using the MVC pattern of Angular
- Understand the programming model provided by the Angular framework
- Define Angular controllers and directives
- Control Angular data bindings
- Implement Responsive Web Applications with Angular
Outline
INTRODUCTION TO ASP.NET MVC
- Review of ASP.NET Web Forms
- Advantages and Disadvantages of Web Forms
- Model-View-Controller Pattern
- ASP.NET MVC
- Advantages and Disadvantages of ASP.NET MVC
- Goals of ASP.NET MVC
- Unit Testing
GETTING STARTED WITH ASP.NET MVC
- An ASP.NET MVC 5 Testbed
- Starter Application
- Simple App with Controller Only
- Action Methods and Routing
- Action Method Return Type
- Rendering a View
- Creating a View in Visual Studio
- The View Web Page
- Dynamic Output
- Razor View Engine
- Embedded Scripts
- Using a Model with a ViewBag
- Controller Using the Model & ViewBag
- View Using the Model and ViewBag
- Using Model Directly
- A View Using Model in Visual Studio
- View Created by Visual Studio
- Passing Parameters in Query String
ASP.NET MVC ARCHITECTURE
- The Controller in ASP.NET MVC
- The View in ASP.NET MVC
- The Model in ASP.Net MVC
- How MVC Works
- Using Forms
- HTML Helper Functions
- Handling Form Submission
- Model Binding
- Greet View
- Input Validation
- Nullable Type
- Checking Model Validity
- Validation Summary
THE MODEL
- Microsoft Technologies for the Model
- SmallPub Database
- ADO.NET
- Language Integrated Query (LINQ)
- ADO.NET Entity Framework
- SmallPub Tables
- SmallPub Entity Data Model
- Entity Data Model Concepts
- Querying the EDM
- Class Diagram
- Context Class
- List of Categories
- List of Books
- A LINQ Query
- IntelliSense
- Controller
- Web.config
- Using a Parameter
- Modifying a Data Source
- Entity Framework in a Class Library
- Data Access Class Library
- Client Code
- ASP.NET MVC Database Clients
- NuGet Package Manager
- Visual Studio Extensions
- Online Gallery
- Entity Framework 6 via NuGet
THE CONTROLLER
- IController Interface
- A Low Level Controller
- Displaying Context
- Add and Subtract
- Controller Base Class
- Action Methods
- HomeController
- Math Controller
- Invoking MathController
- Receiving Input
- Non-Nullable Parameters
- Nullable Parameters
- Using a Model
- HTML Output
- Filters
- Asynchronous Controllers
THE VIEW
- Action Results
- JavaScript Object Notation
- Action Method Attributes
- View Responsibility
- A Program without a View
- A Program with a View
- View Page
- Passing Data to the View
- Passing Lists to the View
- HTML Helper Methods
- Link-Building Helpers
- Form Helpers
- Validation Helpers
- Templated Helpers
- Validation in Model
- Validation in Controller
- ValidationMessage Helper
ROUTING
- ASP.NET Routing
- Routing in ASP.NET MVC
- RouteCollectionExtensions Class
- Default Values for URL Parameters
- Using a Default Route
- Home Controller
- Assigning Parameter Values
- Controller Code
- View Code
- Properties of Routes
- UrlParameter Optional
- A Problem with the Route Map
- Matching URLs to Route
- Route Debugging Utility
- Multiple Matches
- Fixing the Bug
- Debugging Routes
- Areas
UNIT TESTING
- Test-Drive Development
- Functional Tests
- Unit Tests
- Test Automation
- Refactoring
- Regression Testing
- Unit Testing in ASP.NET MVC
- Installing UNnit via NuGet
- A Test Class Library
- The Model
- Testing the Model
- Structure of Unit Tests
- Assertions
- Visual Studio Unit Framework
- Assert Class
- Assert.AreEqual()
- CollectionAssert Class
- StringAssert Class
- Test Case
- Test Methods, Class, Runner
- Ignoring Tests
- Fixing the Bug
- Testing Controllers
- Classes with External Dependencies
- Dependency Injection
- Mocking Frameworks
- Using Moq
- Models
- Controller
- Index View
- Monthly Payment View
- Unit Tests
- Inversion of Control (IoC) Containers
SECURITY
- Web Security
- Input Forgery
- Cross-Site Scripting
- Entering JavaScript
- The Attack
- Blocking the Attack
- Using Razor
- Session Hijacking
- Cross-Site Request Forgery
- Controller and Model Code
- View Code
- Attacker Code
- The Defense
- SQL Injection
- Using the MVC Framework Securely
- Authorize Attribute
- RequireHttps Attribute
- ValidateInput Attribute
ASP.NET WEB API
- REST
- Representation, State and Transfer
- Collections and Elements
- Specifying a Start Page
- Implementing PUT Verb
- Using Fiddler
- Composing a Request
- ASP.NET MVC and We API
- Route Registration
- HTTP Response Codes
- POST Response Code
- HttpResponseException
- Web API Clients
- HttpClient
- Initializing HttpClient
- Issuing a GET Request
- Issuing a POST Request
- Performing CRUD Operations
- Book Repository
- BooksController
- View
- Exercise the Server Using Fiddler
- Client Code: Book Class, Program Class
- ShowBooks()
- AddBooks()
- Update and Delete
Introduction to TYPESCRIPT
Overview
- Environment Setup
- Basic Syntax
- Types, Variables and Operators
- Decision Making and Loops
- Functions and Lambda Expressions
- Generics
- Enums
- Number and Strings
- Arrays
- Tuples
- Union
- Interface, Classes and Objects
- Namespaces
- Modules
- Ambients
- Decorators
- Mixins
Introduction to Angular
- Why Angular 7
- Angular 7 Features
- Installing and Using Angular 7
- Creating the first Angular Project
- Architecture Overview
- What is new in Angular 7
- Summary
Building with Components
- Introducing the component
- Component Decorator Properties
- Template
- Inline Template
- Interpolation – Plain text, Object and Array
- Adding CSS
- Component Starter
- Integrating Bootstrap
- Developing a Header Component
- Developing a Footer Component
- Developing a Product Component
- Summary
Data and Event Binding
- Binding Syntax
- One-Way Output Binding
- Property binding
- Attribute binding
- Binding Events
- Binding Events Examples
- Setting Element Properties
- Setting Properties: Examples
- Two-Way Binding of Input Fields
- Input Binding Examples
- Summary
Attribute Directive
- What are Directives
- Directive Types
- Apply Styles by Changing Classes
- Changing Classes – Example
- Applying Styles Directly
- Applying Styles Directly - Example
- Obsolete Directives and Property Binding
- Controlling Element Visibility
- Setting Image Source Dynamically
- Setting Hyperlink Source Dynamically
- Summary
Structural Directives
- Adding and Removing Elements Dynamically
- Looping Using ngFor
- ngFor - Basic Syntax
- ngFor - Full Template Syntax
- Creating Tables with ngFor
- ngFor Local Variables
- ngFor Changes in the backing data source
- Swapping Elements with ngSwitch
- ngSwitch - Basic Syntax
- ngSwitch - Full Template Syntax
- Summary
Template Driven Forms
- Note on Deprecated Forms APIs
- A Basic Angular Form
- Binding Input Fields
- Accessing the Form Object
- Binding the Form Submit Event
- The Submit Function
- Basic HTML5 Validation - "required" Attribute
- HTML5 vs. Angular Validation
- Angular Validators
- Angular Validation State
- Displaying Form Validation State
- Displaying Field Validation State
- Displaying Validation State Using Classes
- Disabling Submit when Form is Invalid
- Submitting the Form
- Binding to Object Variables
- Additional Input Types
- Checkboxes
- Select(drop down) Fields
- Rendering Options for Select (drop down)
- Date fields
- Radio Buttons
- Summary
Reactive Forms
Introduction
- Registering the reactive forms module
- Generating a new form control
- Registering the control
- Managing control values
- Grouping form controls
- Creating FormGroup
- Associating the FormGroup model and View
- Saving form data
- Displaying the component
- Creating nested form groups
- Grouping the nested form in the template
- Partial model updates
- Generating form controls with FormBuilder
- Injecting the FormBuilder service
- Generating form controls
- Simple form validation
- Dynamic controls using form arrays
Services and Dependency Injection
- What is a Service?
- Creating a Basic Service
- What is Dependency Injection?
- What Dependency Injection Looks Like
- Injecting Services
- Using a Service in a Component: Dedicated Instance
- Using a Service in a Component: Dedicated Instance - Example Code
- Using onInit to Initialize Component Data
- Using a Shared Service Instance
- Dependency Injection and @Host
- Dependency Injection and @Optional
- Summary
RxJS and Observables
- What is an Observable?
- Observable Operators
- Creating Observables Using Static Operators
- What is an Observer?
- Observer Example
- Subject
- Subject Example
- EventEmitter or Observable
HTTP Client
- The Angular HTTP Client
- Using The HTTP Client - Overview
- Setting up HTTP_PROVIDERS in the Root Component
- Importing Individual Providers into Services
- Service Using Http Client
- Service Imports
- The Observable object type
- What does an Observable Object do?
- Making a Basic HTTP GET Call
- Using the Service in a Component
- The PeopleService Client Component
- Client Component Code Review
- Importing Observable Methods
- Enhancing the Service with .map() and .catch()
- Using .map()
- Using .catch()
- Using toPromise()
- GET Request
- GET Request with Options
- POST Request
- POST Request Example
- Reading HTTP Response Headers
- Summary
Pipes and Data Formatting
- What are Pipes?
- More on Pipes
- Using a Built-in Pipe
- Built-In Pipes
- Using Pipes in HTML
- Chaining Pipes
- Using Pipes in JavaScript
- Some Pipe Examples
- Decimal Pipe
- Currency Pipe
- Custom Pipes
- Using Custom Pipes
- A Filter Pipe
- A Sort Pipe
- Pipe Category: Pure and Impure
- Pure Pipe Example
- Impure Pipe Example
- Summary
Introduction to Single Page Applications
- What is a Single Page Application (SPA)
- SPA Workflow
- Traditional Web Application Capabilities
- Single Page Application Advantages
- SPA and Traditional Web Sites
- SPA Challenges
- Implementing SPA's Using Angular 4
- Simple SPA Using Visibility Control
- SPA Using Angular Components
- SPA with Angular Components - Switching
- SPA with Angular Components - The Displayed Component
- Implement SPA Using an Angular Component Router
- Summary
The Angular Component Router
- Routing and Navigation
- The Component Router
- Traditional Browser Navigation
- Component Router Terminology
- Setting up the Component Router
- Local URL Links
- Browser pushState and
- Routes
- The app.routes.ts File
- Bootstrapping Routing in Main.ts
- A Basic App With Routing
- App Routes
- App Component
- Programmatic Navigation
- Basic Navigation
- Passing Data During Navigation
- Creating Routes with Route Parameters
- Navigating with Route Parameters
- Using Route Parameter Values
- Retrieving the Route Parameter Synchronously and Asynchronously
- Query Parameters
- Query Parameters - queryParams
- Query Parameters - Navigation
- Retrieving Query Parameters Asynchronously
- Problems with Manual URL entry and Bookmarking
- Fixing Manual URL entry and Bookmarking
- Summary
Build and Dependency Management
Introduction
- Bower Package Manager
- Managing Packages Using Bower
- Using Bower Packages
- Grunt Build Manager
- Installing Grunt Components
- Writing a Grunt Build Script
- Running Grunt
- Running JSHint Task
- Compiling Less Files
- Compressing CSS Files
- Gulp Build Manager
- Gulp vs. Grunt
- Installing Gulp Components
- Writing a Build Script
- Running Gulp
- Compiling Less Files
- Summary
Programme scope, delivery arrangements and suitability are confirmed during enquiry.