Академический Документы
Профессиональный Документы
Культура Документы
www.ManzoorTheTrainer.com
The Complete
ASP.Net Core MVC Web Developer Course
For Absolute Beginners From Scratch
ASP.Net
Core
MVC
HTML C#.Net EF Core
CSS MS SQL Server
JavaScript
DAL 2017
JQuery BLL
BootStrap Database
UI
C#.Net - BOL
Prerequisite
● You should know how to use computer.
● You should have internet connection.
● It is good if you have some basic understanding of c programming.
● Install MS SQL Server 2017 Express Edition
https://www.microsoft.com/en-us/download/details.aspx?id=55994
● Install Visual Studio 2017 Community Edition
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Commu
nity&rel=15
Thank You
Take The Course Here or Visit : https://bit.ly/2R47dOa
To Achieve Your Dream
Learn MS SQL Server 2017
www.ManzoorTheTrainer.com
Prerequisite
● You should know how to use computer.
● Install MS SQL Server 2017 Express Edition
https://www.microsoft.com/en-us/download/details.aspx?id=55994
● Operating System : Windows 10 , Windows 8, Windows 8.1, Windows Server 2012,
Windows Server 2012 R2, Windows Server 2016
● Processor : Intel - compatible processor with a minimum speed of 1 GHz
● RAM : Minimum 512MB
● Hard Disk Space :4.2 GB of Disk Space
Why is RDBMS?
● In the traditional approach, we used to store information in flat files which are
maintained by the file system under the operating system’s control.
● Application programs go through the file system to access these flat files.
● Unable to achieve Data Safety, Concurrent Access, Fault Tolerance, Data
Integrity, Reporting.
What is RDBMS?
www.ManzoorTheTrainer.com
Primary Key
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on getting started with MS SQL Server
www.ManzoorTheTrainer.com
Foreign key
www.ManzoorTheTrainer.com
Foreign key
● Foreign Key: A foreign key is a “copy” of a primary key that has been exported
from one relation into another to represent the existence of a relationship
between them.
● A foreign key is a copy of the whole of its parent primary key i.e if the primary key
is composite, then so is the foreign key.
● Foreign key values do not (usually) have to be unique.
● Foreign keys can also be null.
● A composite foreign key cannot have some attribute(s) null and others non-null.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Foreign Key
www.ManzoorTheTrainer.com
● Objects ● Relationship
○ Book ○ Customer - Book
○ Customer ○ 1→n
○ n→1
○ n → n (M:M)
www.ManzoorTheTrainer.com
Database Design
● Objects
○ Book
○ Customer
● Relationship
○ Customer - Book
○ 1→n
○ n→1
○ n → n (M:M)
www.ManzoorTheTrainer.com
Database Design
www.ManzoorTheTrainer.com
Students can view,Edit and delete their own details and can change
their password.Can download the Material.Can view the status of the request for
workshop.
www.ManzoorTheTrainer.com
Identifying Objects
● Admin
● Trainer
● Student
● Workshop
● Material
www.ManzoorTheTrainer.com
Database Design
Admin Trainer Student Workshop Material
Aid Wid
Trainer_Workshop Student_Workshop
TWid SWid
Tid Sid
Wid Wid
www.ManzoorTheTrainer.com
Database Design
User Role Workshop Material
Trainer_Workshop Student_Workshop
TWid SWid
uid uid
Wid Wid
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Insert
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on delete and update
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on generating dummy data
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on select query
www.ManzoorTheTrainer.com
Scalar Functions
● A scalar valued function is a function that takes one or more values but returns a
single value.
● String Functions : Len(), Lower(), Ltrim(), Substring(), String_Split()
● Other Functions : Cast(), Convert(), Isnull()
● DateTime Functions : getdate(), year(), month(), day(), DateAdd(), Datediff(),
Datepart(), DateName()
● Mathematical Functions : Ceiling(), Floor(), Round(), Rand()
● Aggregate Functions : Count(), Sum(), Avg(), Max(), Min()
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Scalar Functions
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Group By
www.ManzoorTheTrainer.com
Joins (Multiplication)
● Joins : Used to extract data from multiple tables.
○ Inner Join
○ Left Outer Join
○ Right Outer Join
○ Full Outer Join
www.ManzoorTheTrainer.com
Inner Join
Get only the matched rows from left(child) and the right(master) table.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Joins
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Joining three tables
www.ManzoorTheTrainer.com
Self Join
● Joining a table with itself
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Self Join
www.ManzoorTheTrainer.com
Union (Addition)
● Union : Used to append records of more than one table
○ Union All (A U B with duplicate records)
○ Union (A U B without duplicate records)
○ Intersect (A ⋂ B)
○ Except (A - B)
www.ManzoorTheTrainer.com
Union ALL
www.ManzoorTheTrainer.com
Union
www.ManzoorTheTrainer.com
Intersect
www.ManzoorTheTrainer.com
Except
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Union
www.ManzoorTheTrainer.com
Sub Queries
● Subquery or Inner query or Nested query is a query inside a query.
● Simple Subqueries : Outer query is executed based upon the results of inner query.
○ Scalar Subqueries
○ Multivalued Subqueries
● Correlated Subquery :
○ It is a sub-query that uses values from the outer query.
○ In this case the inner query has to be executed for every row of outer query.
● Common Table Expression (CTE) (Alternate To Views) :
○ It defines the subquery at the beginning of the query using the WITH
command called as CTE
○ CTE can then be accessed multiple times below CTE in main query.
www.ManzoorTheTrainer.com
● Get the subject name which has got the highest marks. (Simple Scalar Subquery)
● Get the students who are taking Maths exam (Nested Scalar Subquery)
● Get the students who has not taken at least one exam (Multivalued Subquery)
Demo
Let’s see a demo on Simple SubQueries
www.ManzoorTheTrainer.com
● Get the employee details with lowest salary from every department.
● Get the topper student details from every subject.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Correlated SubQueries
www.ManzoorTheTrainer.com
Views
● A view is a list of columns or a series of records retrieved from one or more
existing tables, or as a combination of one or more views and one or more tables.
● Use views to denormalize or simplify complex joins and hide any keys used to
link data within the database schema.
● In other words it is use full for generating various reports easily.
www.ManzoorTheTrainer.com
Senario - Views
● Get the subject name and number of students taking exam on that subject.
● Get the student name, subject name and marks they get in that subject.
● Get the student name and total mark they got.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for views
www.ManzoorTheTrainer.com
DML On Views
● You can perform all operation on a view that is based on one table, that would be
entered on the base table.
● You can perform only select & update operations on a view which is based on
multiple table, that would affect the base tables.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for DML on views
www.ManzoorTheTrainer.com
● Get department name and number of employees in each dept along with
department name and total salary being paid to every department
www.ManzoorTheTrainer.com
A Simple CTE
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on CTE SubQueries
www.ManzoorTheTrainer.com
Stored Procedures
● Stored Procedure is precompiled set of one or more SQL statements which
performs some specific task.
● Store Procedure should be executed stand alone using EXEC.
● Store Procedure can return multiple parameters.
● Store Procedure can be used to implement transaction.
● Create, Alter and Drop Stored Procedures
○ With No Parameters and No Return values
○ With Parameters and No Return values
○ With Parameters and Return values
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for Stored Procedures
www.ManzoorTheTrainer.com
● Get all the employees with department details when department Id is not passed
or NULL else all the employees with department details of a particular
department.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for Stored Procedures
www.ManzoorTheTrainer.com
Functions
● A Functions is a section of code that performs an independent task.
● Function cannot be executed stand alone, it is always used in a query like with
select clause.
● Functions can return one and only one parameter.
● We cannot implement transaction using functions.
www.ManzoorTheTrainer.com
Senario - Function
● Get the student name, total mark they got along with grade. Where grade is the
value returned from GetGrade() function.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for functions
www.ManzoorTheTrainer.com
Transactions
● Transaction is a set of operation (SQL Queries) which must be executed as a
group.
● If at all a single operation fails then all the previous operation of that group must
be rolled back i.e., undone.
www.ManzoorTheTrainer.com
Scenario - Transaction
Scope_Identity()
● How to get the EmpId value to insert in SalaryHistory table?
● As EmpId is identity column.
● Scope_Identity function returns the recent generated identity value (that is auto
incremented values) for that particular scope i.e., user.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for ScopeIdentity()
www.ManzoorTheTrainer.com
Scenario - Transaction
Demo
Let’s see a demo for Transactions
www.ManzoorTheTrainer.com
Triggers
● A trigger is an action that is performed behind-the-scenes when an insert, update
or delete operation has been performed on a table.
● The trigger must be created in connection to a table of a non-system database
● Triggers are of 2 types in SQL Server:
● DML Triggers
○ AFTER Triggers
○ INSTEAD OF Triggers
● DDL Triggers
www.ManzoorTheTrainer.com
Creating Triggers
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for Triggers
www.ManzoorTheTrainer.com
Insert Operation
Department Inserted Table
Insert a record
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for Inserted Table
www.ManzoorTheTrainer.com
Update Operation
Department Inserted Table
103 Development
Dev Dev Dept
103 Development Dev Dept
Update a record
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for Updated Table
www.ManzoorTheTrainer.com
Delete Operation
Department Inserted Table
Delete a record
www.ManzoorTheTrainer.com
Demo
Let’s see a demo for Deleted Table
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Admin Tasks
www.ManzoorTheTrainer.com
Assignment
● Write a query which takes the OrderId
as input and displays all the customer
details and product details along with
the last date of order delivery.
Thanks
Ask any questions if you have...
www.ManzoorTheTrainer.com
Prerequisite
● You should know how to use computer.
● Install Visual Studio 2017 Community Edition
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Commu
nity&rel=15
● Operating System : Windows 10 version 1507 or higher, Windows 8.1 (with
Update 2919355), Windows Server 2012 R2, Windows 7 SP1
● Processor : Intel - 1.8 GHz or faster processor. Dual-core or better recommended
● RAM : 2 GB of RAM; 4 GB of RAM recommended
● Hard Disk Space :up to 130 GB of available space, depending on features installed;
typical installations require 20-50 GB of free space.
www.ManzoorTheTrainer.com
.Net Flavours
● .Net Framework
● .Net Core (Our Course Focus)
www.ManzoorTheTrainer.com
What is .Net ?
● What can we do with .Net?
○ We can develop applications like Console App, Windows App, Web App,
Mobile App, Web services, Windows services, etc.,
● Why .Net?
○ Because it is a language and OS neutral platform.
● What is .Net?
○ It is a language and OS neutral platform on which we can develop any kind
of applications.
.NET Framework Vs .NET Core
.NET Framework 4.6
● It is our old framework enhanced that we have been using for more than a decade.
● It is not open source
● It can target only windows OS
● It has all the components like Windows Form Application, ASP.Net Web Forms,
ASP.Net MVC, ASP.Net Web API, ASP.Net SignalR, ASP.Net Web Pages, WPF,
WCF, etc.,
.NET Core X.X (1, 2, 3, …)
● It is a new framework similar to .net framework maintained by Microsoft and the
.NET community on GitHub.
● It is open source.
● It can target Windows, Linux & Mac OS.
● It does not have all the components, It just has ASP.Net Core and Universal
Windows App.
“.Net was language neutral,
.Net Core is OS neutral.”
- www.ManzoorTheTrainer.com
www.ManzoorTheTrainer.com
Language Neutral
● Same class library with different syntax
○ Console::WriteLine(L"C++ Hello, World!");
○ Console.WriteLine("C# Hello, World!");
○ Console.WriteLine ("VB Hello, World!")
www.ManzoorTheTrainer.com
Assembly
IL
First.cs Compile (CSC) Execute Output
MSIL
(.dll or .exe)
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on C# First Program
www.ManzoorTheTrainer.com
Assemblies
● Assemblies are the building blocks of .NET Framework applications; they form
the fundamental unit of deployment.
● An Assembly is a logical unit of code.
● Assembly physically exist as DLLs or EXEs.
● Every assembly file contains:
○ Information about itself called as Assembly Manifest.
○ Information about classes called as Metadata.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Assemblies
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Getting Started
www.ManzoorTheTrainer.com
Control Structures
● Conditional Statements ● Iterative Statements
○ If ○ For
○ If else ○ While
○ Else if ladder ○ Do while
○ Switch case default ○ foreach
● UnConditional Statements
○ Goto
○ Continue
○ break
○ return
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Control Structures
www.ManzoorTheTrainer.com
Assignment
Write a C# program which takes current meter reading (CMR), previous meter
reading (PMR) and type of connection as input and displays the bill amount.
Arrays
● It is a user defined collection of homogeneous data type elements.
● We use index to access an element of an array.
● When declaring an Array, specify the type, name, dimensions, and size.
● int[ ] myArray = { 5, 10, 15 };
● int[] myArray = new int[3];
○ myArray[0]=5;
○ myArray[1]=10;
○ myArray[2]=15;
● Int[,] my2dArray = new int[2,3];
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Arrays & foreach Loop
www.ManzoorTheTrainer.com
Structures
● It is a user defined collection of
heterogeneous data type elements.
● We use period operator to access
an element of the structure.
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on Structures
www.ManzoorTheTrainer.com
Struct vs Classes
● Structs Only:
○ Cannot support inheritance
○ Are value types
○ Are passed by value (like integers)
○ Cannot have a null reference (unless Nullable is used)
○ Do not have a memory overhead per new instance - unless 'boxed'
● Classes Only:
○ Can support inheritance
○ Are reference (pointer) types
○ The reference can be null
○ Have memory overhead per new instance
● Both Classes and Structs:
○ Are compound data types typically used to contain a few variables that have some logical
relationship
○ Can contain methods and events
○ Can support interfaces
www.ManzoorTheTrainer.com
var Vs dynamic
● var is static typed. It identifies the variable type at compile time itself.
○ var type is fixed with initialization
○ var x=”ManzoorTheTrainer”;
● dynamic is a runtime dispatch type. It identifies the variable type at runtime.
○ dynamic x=”ManzoorTheTrainer”;
○ dynamic type can changes where it is required
www.ManzoorTheTrainer.com
Demo
Let’s see a demo on var Vs dynamic
www.ManzoorTheTrainer.com
● Objects ● rollNo
○ Jack Properties ● name
● marks
○ Peter
Class
○ John
● getDetails()
Methods
● getResult()
www.ManzoorTheTrainer.com
Fields
Defining A Class
● Defining A Class
● Defining Fields
● Defining Methods
Methods
● Public and Private specifiers
www.ManzoorTheTrainer.com
Demo
For Defining A Class
www.ManzoorTheTrainer.com
Object Creation
● Creating Object
● Accessing Method
www.ManzoorTheTrainer.com
Demo
For Object Creation
www.ManzoorTheTrainer.com
Constructor
● Why do i need constructor?
● Creating a constructor
www.ManzoorTheTrainer.com
Constructor
● It’s a special method with same name as class name
● Usually constructor is public.
● It won’t have any return type.
● It may or may not have parameters.
● Constructor with no parameters is called as default constructor.
● Constructor is invoked automatically when we create an object.
● You cannot invoke constructor explicitly.
● It is used to initialize an object.
www.ManzoorTheTrainer.com
Demo
For Constructor
www.ManzoorTheTrainer.com
Constructor Overloading
● If we have more than one constructor
with different parameters then we call
it as constructor overloading
www.ManzoorTheTrainer.com
Demo
For Constructor Overloading
www.ManzoorTheTrainer.com
this Keyword
● this keyword is a default object of
current class.
● In what ever class we use “this” keyword
it acts like its object
● ‘this’ keyword has two uses.
● ‘this’ keyword is used to refer the
members of same class.
● It is also used to invoke a constructor
from another constructor of the same
class.
www.ManzoorTheTrainer.com
Demo
For this Keyword
Method Overloading
www.ManzoorTheTrainer.com
Demo
For Method Overloading
www.ManzoorTheTrainer.com
Properties
● Properties are special kind of methods to access
any field in a secured way.
● It contains two kind of methods i.e., getter and
setter.
● Getter method is to read the value of the
private field.
● Setter method is to write the value of the
private field.
● It looks like we are accessing the fields directly.
But, internally it works as methods where we
can perform some kind of validations.
www.ManzoorTheTrainer.com
Demo
For Properties
www.ManzoorTheTrainer.com
Demo
For Latest Class Style
www.ManzoorTheTrainer.com
Static Variables
● Any member of a class declared with
the keyword static is called as static
member.
● Memory for static variable is allocated
only once and is shared by all the
objects of that class.
● We can access static variables with
directly with the class name if they are
public.
www.ManzoorTheTrainer.com
Demo
For Static Variables
www.ManzoorTheTrainer.com
Static Constructor
● Static constructor is a constructor
which is declared with the keyword as
static.
● Static constructor is use to initialize
static variables (private).
● Static constructor does not have any
access modifiers (i.e,Public,Private).
● Static constructor is parameter less.
● There can be one and only one static
constructor in a class.
● Static Constructor is invoked before
creation of any object.
www.ManzoorTheTrainer.com
Demo
For Static Constructor
www.ManzoorTheTrainer.com
Static Methods
● Static method is a method which is
declared with the keyword static.
● There can be n number of static
methods in a class.
● Static methods can access only static
variables.
● Static method can be directly accessed
by Class name.
www.ManzoorTheTrainer.com
Demo
For Static Methods
www.ManzoorTheTrainer.com
Static Class
● Static class is a class which is declared
with static keyword.
● Static class should contain only static
methods.
● Static class does not allow creation of
class reference or object.
● Like Console is a predefined static
class which contains all static methods
like WriteLine()
www.ManzoorTheTrainer.com
Demo
For Static Classes
www.ManzoorTheTrainer.com
Namespaces
● Namespaces are logical group of
classes and namespaces.
● It is used for avoiding name clashes
between two sets of code.
www.ManzoorTheTrainer.com
Demo
For Namespaces
www.ManzoorTheTrainer.com
Organization.dll
Web App Employee.cs
GetSalary()
Console
App
Note : Every UI/PLL will have a local copy of dll, any changes made dll will not be reflected
automatically
www.ManzoorTheTrainer.com
Organization.dll
● Create a new project Organization.
● Create a class Employee
● Create a method GetSalary()
● Create a Console UI
● Add dll reference
● Add namespace
● Create Object of Employee
● Call GetSalary
● Public and non public class
www.ManzoorTheTrainer.com
Demo
For dll Consumption in ConsoleUI
www.ManzoorTheTrainer.com
Demo
For .Net Standard Library
www.ManzoorTheTrainer.com
Inheritance
● Deriving a new class from an existing
class is called Inheritance.
● Existing class is called as base class.
● New class is called as derived class.
● Everything from the base class gets
inherited except private members.
IS - A
www.ManzoorTheTrainer.com
Demo
For Inheritance
www.ManzoorTheTrainer.com
Types Of Inheritances
● Single Inheritance : If a derived class has a
single base class then it is called as single Single
inheritance i.e., A(Base) → B (Derived)
● Multilevel Inheritance : If a class is derived
from a class which is already a derived class
then it is called as multi level inheritance.
i.e., A(Base) → B (Derived) → C(Derived)
● Multiple Inheritance : If a class is derived
from more than one class then it is called as
which is already a derived class then it is
called as multiple inheritance.i.e., A,B(Base) Multilevel
→ C(Derived)
● C# does not support multiple inheritance
using classes.
www.ManzoorTheTrainer.com
Demo
For Types Of Inheritance
www.ManzoorTheTrainer.com
Protected Members
● Protected members of a classes can be
inherited in the child class.
● Protected members of a class cannot
be accessed from outside of a class.
www.ManzoorTheTrainer.com
Demo
For Protected Members
Constructor Chaining (Or)
www.ManzoorTheTrainer.com
base keyword
● Any constructor of child class always
invokes default constructor of base
class.
● Calling the base class constructor
from the child class’ constructor using
base keyword is called as constructor
chaining.
● base keyword is a default object of its
base class.
● It is also used to refer the members of
base class from derived class.
www.ManzoorTheTrainer.com
www.ManzoorTheTrainer.com
Method Overriding
● If a method in the derived class has the
same signature as that of in the base
class with different implementation
then we say that method in the derived
class overrides the method of base
class.
● This process is called as Method
Overriding.
● The method of the base class should be
declared as virtual and method in
derived class should be declared as
override.
www.ManzoorTheTrainer.com
Demo
For Method Overriding
www.ManzoorTheTrainer.com
Demo
For Sealed Methods And Classes
www.ManzoorTheTrainer.com
Abstract Method
● An abstract method is a method which
is declared with the keyword abstract.
● It does not have body.
● It should be implemented by the
derived class.
● If a method is abstract then the class
should be abstract.
www.ManzoorTheTrainer.com
Demo
For Abstract Method
www.ManzoorTheTrainer.com
Abstract Class
● It is the blueprint of the problem.
● It says what to do but not how to do.
● An abstract class is the class which is
declared with the keyword abstract.
● Basically it contains at least one
abstract method.
● It’s object cannot be created.
● But it’s reference can be created.
● It is used to implement runtime
polymorphism.
www.ManzoorTheTrainer.com
Demo
For Abstract Class
www.ManzoorTheTrainer.com
Demo
For Runtime Polymorphism
www.ManzoorTheTrainer.com
Interface
● An interface is a pure abstract class.
● It is a reference type and it contains only
abstract members.
● Any implementation must be placed in
class that implements them.
● All the member declarations inside
interface are implicitly public and
abstract.
● We can implement multiple inheritance
using interfaces.
www.ManzoorTheTrainer.com
Demo
For Interfaces
www.ManzoorTheTrainer.com
Partial Class
● Partial class is a class which is declared
with partial keyword.
● Its implementation can be spread over
multiple files.
● Multiple classes prefixed with partial
keyword with same class name and
different methods in different files, acts
as a single class with all the methods.
www.ManzoorTheTrainer.com
Demo
For Partial Classes
www.ManzoorTheTrainer.com
Collection Classes
● Collection is an alternate way of storing
multiple variable number of elements or
objects.
● Like Stack, Queue, ArrayList , etc., are
collection classes present in
System.Collection namespace
● There is no type safety in collection
classes i.e., in a collection object of a
Queue we can store few integers and few
strings.
● We need to type cast the elements while
accessing it.
www.ManzoorTheTrainer.com
Demo
For Collection Classes
www.ManzoorTheTrainer.com
Demo
For Generic Collection Classes
www.ManzoorTheTrainer.com
Exception Handling
● Runtime error is called as an exception.
● Exception handling is an in-built
mechanism in .NET core to detect and
handle runtime errors.
● C# provides three keywords try, catch
and finally to do exception handling.
● The try encloses the statements that
might throw an exception.
● The catch handles an exception if one
exists.
● The finally can be used for doing any
clean up process.
www.ManzoorTheTrainer.com
Demo
For Exception Handling
www.ManzoorTheTrainer.com
Thanks
www.ManzoorTheTrainer.com
Prerequisite
● Learn MS SQL Server From Scratch
● Learn C#.Net Core From Scratch
www.ManzoorTheTrainer.com
What is EF ?
● Entity framework is the latest technology provided by ADO.net for accessing
database.
● It is an O/RM tool (Objects Relation Mapping).
● It provides easy and automated way of mapping between Objects(Classes) and
Relations(Tables).
● It auto generates most of the data-access code.
www.ManzoorTheTrainer.com
What is EF Core ?
● EF Core is an O\RM tool.
● Entity Framework Core is the latest data access technology for .Net developers.
● EF Core has almost same interface as EF6.X.
● EF Core can be used to access NoSQL DB. Where as EF6.X cannot.
● EF Core can run on Windows, Linux, and Apple. Where as EF6.X is only for Win.
● There are two approaches of working with EF Core
○ Code-First
○ Database-First (Reverse Engineering)
www.ManzoorTheTrainer.com
Code-First Approach
In the Code-First approach, you focus on your application and start creating classes for
it and we call them as business entities or business objects.
Getting Started
www.ManzoorTheTrainer.com
With EF Core
● Start a new .Net Core Console App
● Install - Nuget Packages
● Microsoft.EntityFrameworkCore.SqlServer
● Create an Entity Department
EF Core DbContext
www.ManzoorTheTrainer.com
Creating A
Database - 5 Steps
1. Install - Nuget Packages
Microsoft.EntityFrameworkCore.Tools
2. Override OnConfiguring() method in
OrganizationContext with connection
string.
3. Open Package Manager Console and
run the below commands
4. add-migration OrganizationDb
5. update-database
www.ManzoorTheTrainer.com
● Objects ● Relationship
○ Department ○ Department - Employee
○ Employee ○ 1→n
○ n→1
○ 1 → n (1:M)
www.ManzoorTheTrainer.com
Relationship(1:M) - #2
● Department will have list of employees and Employee will refer to a single department.
www.ManzoorTheTrainer.com
● Objects ● Relationship
○ Course ○ Course - Student
○ Student ○ 1→n
○ n→1
○ n → n (M:M)
www.ManzoorTheTrainer.com
Relationship(M:M) - Entities - #3
● Student will have list of Student_Course
● Course will also have list of Student_Course
● It will have a new entity Student_Course referring to Student & Course
www.ManzoorTheTrainer.com
Relationship(M:M) - Tables
www.ManzoorTheTrainer.com
● The Employee can raise a request with status open for a new hardware or
software component to be installed on their system.
● Employee can also raise a request with status open for update or repair of an
existing hardware or software component.
● IT Manager has rights to approve or reject the request. on approval, the request is
assigned to IT Assistant.
● IT Assistant can then works on it and completes the task and change the request
status to completed.
● Finally IT Manager has rights to close the completed request.
www.ManzoorTheTrainer.com
● The Employee can raise a request with status open for a new hardware or
software component to be installed on their system.
● Employee can also raise a request with status open for update or repair of an
existing hardware or software component.
● IT Manager has rights to approve or reject the request. on approval, the request is
assigned to IT Assistant.
● IT Assistant can then works on it and completes the task and change the request
status to completed.
● Finally IT Manager has rights to close the completed request.
www.ManzoorTheTrainer.com
● Employee
● IT Manager
● IT Assistant
● Component
● Request
● Status
www.ManzoorTheTrainer.com
● Table()
● Column()
● Key
● Required
● MaxLength()
● DatabaseGenerated()
● ConcurrencyCheck
● NotMapped
● ForeignKey()
www.ManzoorTheTrainer.com
CRUD - Insert
● Insert
www.ManzoorTheTrainer.com
CRUD - Update
● Update
CRUD - Delete
www.ManzoorTheTrainer.com
● Delete
CRUD - Select
www.ManzoorTheTrainer.com
Note : Property in an entity which represents (Primary -Foreign key) relationship with another entity is
called as navigation property. As here Department is navigation property in Employees
www.ManzoorTheTrainer.com
EF Core
● EF Core allows you to work with Raw
SQL.
● It is useful if the query you want to
perform can't be expressed using LINQ.
● If using a LINQ query is resulting in
inefficient SQL being sent to the
database.
● Use : FromSql(), ExecuteSqlCommand()
● Limitations :
https://docs.microsoft.com/en-us/ef/core/
querying/raw-sql
Working With Stored
www.ManzoorTheTrainer.com
Procedures EF Core
● Create An empty migration file.
● PM> Add-migration All_SPs.
● Create SPs in Up() and drop SPs in
Down() of generated migration file.
● Use : FromSql(), ExecuteSqlCommand()
to execute an existing stored procedure.
● With return type as an existing entity.
● With Custom return type.
Default Transaction
www.ManzoorTheTrainer.com
In EF Core
● Say we are inserting 1 record and
updating 2 records and finally calling
SaveChanges().
● By default, SaveChanges() are applied in
a transaction.
● Which means If any of the operations
fail, then the transaction is rolled back.
● You can also manually control
transactions if you have multiple
SaveChanges() method Call.
Manually Controlling
www.ManzoorTheTrainer.com
Transaction In EF Core
● You can also manually control
transactions if you have multiple
SaveChanges() method Call.
● We use the DbContext.Database to begin,
commit, and rollback transactions.
● Transactions are always applied on try
catch blocks
www.ManzoorTheTrainer.com
UI
EF Core
MS SQL
DAL Server
.Net Core
Console App
UI
BOL - Entities
www.ManzoorTheTrainer.com
UI
C#.Net EF Core
MS SQL
BLL DAL Server
.Net Core
Console App
UI
BOL - Entities
www.ManzoorTheTrainer.com
3 - Layered Approach
1. Add BOL
2. For Attributes Install Package :
a. System.ComponentModel.Annotations
3. Add DAL as EF Core Install Packages :
a. Microsoft.EntityFrameworkCore.SqlServer
b. Microsoft.EntityFrameworkCore.Tools
4. add-migration & update-database
5. Write data access classes with repository pattern.
6. Add BLL & Write business classes
7. Add .Net Framework Web Forms UI
8. Install Package In UI :
a. Microsoft.EntityFrameworkCore.SqlServer
www.ManzoorTheTrainer.com
Thank You
Learn HTML & CSS
From Scratch
Mohd Manzoor Ahmed [MCT]
manzoor_trainer manzoorthetrainer.com
What Are We Going To Learn?
● Introduction To HTML ● Images
● Page Structure ● Static Vs Dynamic Pages
● Tags ● Forms
● Comments And Page Information ● Introduction To CSS
● Document Structure ● Approaches Of Applying Style
● Links ● CSS Selectors
● Text Markup ● Develop A Static Web Site
● Lists
● Tables
Why HTML?
Share information with the world in the form of different pages linked together.
What is HTML?
● HTML stands for HyperText Markup Language.
● It is used to design and develop Web Pages.
○ Simple
○ Browser/Platform Independent
○ Not Case Sensitive
○ A medium for User Interface
Observation..
Let’s observer a real world any page. Say Google.com
<!DOCTYPE>
Page Structure
HTML Or Web Page
A Demo..
● Let us create our first page say MyFirstPage.html.
● You can use any text editor to create a web page, say notepad.
● Its extension should be either htm or html(popularly used).
● We need any browser to run the page, say chrome.
Introduction To Visual Studio
● https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx
Any Version
<div id=”myDiv”> Hello </div>
Key Value
HTML Element
Everything Is A Tag
● The HTML instructions are called Tags. Basically tags are classified into two
categories.
● Container Tags :Tags that have starting as well as ending part.
○ e.g.: <TITLE>Title of the Web Page </TITLE>
● Empty Tags : Tags that do not have the closing part.
○ e.g.: <br>
● HTML instructions + text to which the instructions apply is an HTML element.
Attributes
● A key value pairs inside the tag which defines the some features of text are called
as Attributes.
● Some important attributes of the BODY tag
○ BGCOLOR = “color” / “#rrggbb”
○ BGPROPERTIES=”FIXED”
○ BACKGROUND = “url of the image”
○ TEXT = “color” / “#rrggbb”
● Core attributes of other tags inside body.
○ id, name, value and class
Demo..
For Attributes
Comments And Page Information
● <!-- Comment Text -->
● Page information goes into the <head> tag
● Mostly used page information tags are
○ <meta/>
○ <title>
○ <link/>
○ <style>
○ <script>
Demo..
For Page Information
Document Structure
● Below are the mostly used tags to structure the content on the body of the page.
○ <h[1-6]>
○ <div>
○ <span>
○ <p>
○ <pre>
○ <br/>
○ <hr/>
Demo..
For Document Structure Tags
Text Markup
● Tags mostly used to give some different style or look to the text on the body of
page.
○ <strong>
○ <em>
○ <code>
○ <del>
○ <sub>
○ <sup>
Demo..
For Text Markup
Lists
● The tags used to list items either in bullet style or numbered style
○ <ol>
○ <ul>
○ <li>
Demo..
For List
Tables
Most of the page layouts are based upon tables or to show some tabular data on web
pages we some time use tables
● <table> ● <col>
● <caption> ● <tr>
● <thead> ● <th>
● <tbody> ● <td>
● <tfoot>
Demo..
For Tables
Images
● To display images on web page we use image tag i.e.,
○ <img>
Demo..
For Images
Links
● The link tags are also called as anchor tag <a href=’xxx’></a>
● The link tags are used to
○ Link one page to another page .
○ To make a section of page as anchor.
○ One section of page to another section(anchor) of page.
○ Link to send email board
Demo..
For Anchor Tag
Static Vs Dynamic Pages
● Static Web Page ● Dynamic Web Page
● Same content to any user, anywhere ● Content may differ as per the user
● Requires web development expertise request and location
to update site ● Much more functional website
● Site not as useful for the user ● Much easier to update
● Content can get stagnant ● New content brings people back to
the site and helps in the search
engines
Forms
● Whenever we want to interact with end user basically we need a form.
● Forms can be created with the following form tags
○ <form> ○ <select>
○ <fieldset>(I love it) ○ <option>
○ <legend> ○ <textarea>
○ <input>
Demo..
For Form Design
Why CSS?
● As HTML is mark-up language, I say CSS is a make-up language.
● Don’t you want your content look good to the end user
What is CSS?
● CSS stands for Cascading Style Sheets.
● CSS describes how your web page should look.
● For example its layout, color, font, size, etc.,
Observation..
Let’s observer a real world any page. Say Google.com
Three Different Approaches
● There are three different approaches of inserting a style sheet:
○ Inline style
○ Internal style sheet
○ External style sheet
InLine
● It is used to apply style to a single element.
● Eg:
● <div id="myDiv" style="color:white; background-color:linen;">
This is my Div.
</div>
Selector
div.x {
Decoration color: red;
text-align: center;
Style For Div
Decoration
}
Property Value
CSS Selectors
● To find an element on the page and map it to the style we use different selectors.
● Few of them are as follows
○ Element
○ id
○ class
○ grouping
element Selector
Select all <div> elements and apply the style.
div {
color: red;
text-align: center;
#myDiv {
color: red;
text-align: center;
.myClass {
color: red;
text-align: center;
Div.myClass {
color: red;
text-align: center;
}
<div id= “div1” class=”myclass”> The content goes here </div>
Left Content
footer
Demo..
For developing static website.
Learn JavaScript From Scratch
Mohd Manzoor Ahmed
(Microsoft Certified Trainer | 15+yrs Exp)
What Are We Going To Learn?
● Introduction To JavaScript ● Types Of Variables
● Introduction To Visual Studio ● Events
● Modes Of Execution ● OOPs Through JavaScript
● Data Types In JavaScript ● Object
● Conditional Statements ● Class
● UnConditional Statements ● Properties
● Iterative or Loop ● Methods
● Array Variable Declaration ● List Of Objects
● Functions ● Stand Alone Object/s
Why JavaScript?
● We need responsive HTML pages.
○ React to events.
○ Read and write HTML elements.
○ Validate data.
○ Detect the visitor's browser.
○ Lot more these days....
What is JavaScript?
● JavaScript is a scripting and lightweight programming language.
● It is an interpreted language and requires a browser to run it.
● Everyone can use JavaScript without purchasing any license.
● It is usually embedded directly into HTML pages in script tag inside head tag.
● You can use any text editor to write javascript including HTML
○ <head>
○ <script type=”text/javascript”>
○ ……………….
○ </script>
○ </head>
Display Hello World
● Mostly used methods to display any content at runtime on web page are
○ document.write()
○ console.log()
○ window.alert()
Demo
For “Hello World”
What is JavaScript?
● But these days it is being written in separate file and it’s extension is .js say
myScript.js
● It is being referred in the web pages using script tag at the bottom of the page, i.e.,
after body tag.
○ <html>
○ <head>
○ </head>
○ <body>
○ </body>
○ <script type=”text/javascript” src=”myScript.js”/>
○ </html>
Demo
For .js file
IDE - Introduction To Visual Studio
● https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
Any Version
Demo
Getting Friendly with Visual Studio 2015
Modes Of Execution
● Immediate mode of script execution is writing script inside body tag and gets
executed as soon as page loads.
● Deferred mode of script execution is writing script in head tag and gets executed
on any event.
Demo
For both immediate and deferred modes
Data Types In JavaScript
● numbers
● strings
● arrays
● objects
● array of objects
Single Variable Declaration
● var x; ● var x=10;
● x=10; ● x=’Peter’;
● or ● x=”John”;
● var x=10; ● x=12.6;
● or
● x=10;
Performing Operations - Require Operators
● Arithmetic : +,-,*,/,%
● Assignment : =, += (x+=y => x=x+y),-=,*=,%=
● Comparison : ==,===,!==,!===,<,<=,>,>=,
Demo
For All Operations
Control Structure
● Controlling the flow of our structure is achieved through the following statements
● Conditional
○ if, if else, else..if ladder and switch..case
● UnConditional
○ break, continue, goto and return. (Covered in functions)
● Iterative or Loop
○ for, while, do while, for/in
Conditional Statements - if else
<script type="text/javascript">
var t=6;
if (t<10) {
document.write("<b>Good morning</b>");
}
else {
document.write("Good day!");
}
</script >
Conditional Statements - else if Ladder
<script type="text/javascript">
var t=16;
if (t<10) {
document.write("<b>Good morning</b>");
}
else if (t>10 && t<16) {
document.write("<b>Good day</b>");
}
else {
document.write("<b>Hello World!</b>");
}
</script>
Demo
For if, if else and else if ladder
Conditional Statements - switch case default
<script type="text/javascript">
theDay=5;
switch (theDay){
case 5: document.write("Finally Friday");
break;
case 6: document.write("Super Saturday");
break;
case 0: document.write("Sleepy Sunday");
break;
default: document.write("I'm looking forward to this weekend!");
}
</script>
Demo
For switch case default
Iterative Statements - for
Syntax
Ex:
for(i=0;i<10;i++){
document.write(“MTT”+<br/>);
}
Demo
For for loop
Iterative Statements - while
Syntax:
while (condition) {
___________
}
Eg:
i=0;
while(i<10){
document.write(“MTT”+<br/>);
i++;
}
Demo
For while loop
Iterative Statements - do while
Syntax:
do {
_____________
}
while (condition);
Eg:
i=0;
do{
document.write(“MTT”+<br/>);
i++;}
while(i<10);
Demo
For do while
Array Variable Declaration
● An Array is collection of similar type of elements.
● It can be defined in three ways
● Literal Array: var x=[‘Peter’,’John’,’Bob’]; or var x=[]; //best approach
● Condensed Array: var x=new Array(‘Peter’,’John’,’Bob’);
● Regular Array: var x=new Array();
○ x[0]=’Peter’;
○ x[1]=’John’;
○ x[2]=’Bob’;
● length,push(),sort(), reverse().
Demo
For arrays
Iterative Statements - for/in
Syntax:
for(item in list)
{
____________
}
● onload
Eg:
<element onload="script">
Note:
● onfocus : textbox
● onblur : textbox
● onchange : textbox and dropdown list
● onsubmit : form
Note:
● onkeydown //textbox
● onkeyup //textbox
● onkeypress //textbox
Note:
● onclick : button
● onmouseover : link
● onmouseout : link
Note:
○ lstObj[0].RollNo
Demo
For Stand Alone Object\s
Why OOPs?
● No strong binding between data and functions.
Demo
For Why OOPs
OOPs Through JavaScript
● Object
● Class
● Properties
● Methods
Analogy
Student
● Objects ● rollNo
○ Jack Properties ● name
● marks
○ Peter
Class
○ John
● getDetails()
Methods
● getResult()
Object & Class
● Object
○ Any real time entity is called as an object.
○ Every object consist of state(look and feel) and behaviour(what is does).
○ States are called as properties and behaviors are called as methods.
● Classes
○ Class is a blueprint of an object.
○ It consist of fields which are not allowed to access from outside the class.
○ It also consist of methods which are allowed to access from outside the class.
Constructor
● Constructor is invoked automatically when we create an object.
● You cannot invoke constructor explicitly.
● It is used to initialize an object.
● Here in javascript, it is slightly different.
function Student(){
this.rollNo=123;
Defining A Class
this.name="ManzoorThetrainer";
this.marks=75;
}
Demo
For Defining A Class
var obj=new Student();
alert(obj.rollNo + “ ” obj.name);
alert(obj.rollNo + “ ” obj.name);
alert(obj.getResult());
Demo
For Object Creation
function Student(r,n,m){
this.rollNo=r;
Constructor this.name=n;
this.marks=m;
● Creating Class …
● Creating Object …
● Accessing Properties
}
● Accessing Method
var obj=new Student(1,”Jack”,78);
alert(obj.rollNo + “ ” obj.name);
alert(obj.getResult());
Demo
For Constructor
function Student(r,n,m){
this.rollNo=r;
this.marks=m;
● Creating List Of Object …
● Accessing Object’s Properties …
● Accessing Object’s Method
}
lstObj.push(new Student(1,”Jack”,78));
lstObj.push(new Student(2,”Peter”,81));
Demo
For List Of Objects
Thanks
Learn ASP.Net Core
MVC From Scratch
Mohd Manzoor Ahmed [MCT]
manzoor_trainer manzoorthetrainer.com
Prerequisite
● C#.Net Core
● EF Core
● HTML & CSS
● MS SQL Server (Recommended)
● JavaScript (Recommended)
● HTML5 & Bootstrap (Recommended)
● JQuery (Recommended)
.NET Framework Vs .NET Core
.NET Framework 4.6
● It is our old framework enhanced that we have been using for more than a decade.
● It is not open source
● It can target only windows OS
● It has all the components like Windows Form Application, ASP.Net Web Forms,
ASP.Net MVC, ASP.Net Web API, ASP.Net SignalR, ASP.Net Web Pages, WPF,
WCF, etc.,
.NET Core X.X (1, 2, 3, …)
● It is a new framework similar to .net framework maintained by Microsoft and the
.NET community on GitHub.
● It is open source.
● It can target Windows, Linux & Mac OS.
● It does not have all the components, It just has ASP.Net Core and Universal
Windows App.
www.ManzoorTheTrainer.com
MVC - View
● Whatever we see on the web page is a
View.
● It is a presenting content file with
.cshtml extension.
● It is send to the user in response to a
request from controller.
Updating To
www.ManzoorTheTrainer.com
1. Create RegistrationViewModel
2. Create UserManager And
SignInManager objects.
3. Create an action to render user
registration form.
4. Create another action to handle
registration request.
Login And Logout - 7 Steps
www.ManzoorTheTrainer.com
1. Create LoginViewModel
2. Create UserManager And
SignInManager objects.
3. Create an action to render login form.
4. Create another action to handle login
request.
5. Apply [Authorize] attribute on
Controllers to secure it.
6. Finally we will also show and hide links
based on login and logout.
7. Applying [Authorize] at application
level and use [AllowAnonymous]
Email Confirmation - 6 Steps
www.ManzoorTheTrainer.com
1. Create ForgotPasswordViewModel.
2. Create action to render forgot
password form.
3. Create an action to handle forgot
password.
4. Find user by Email.
5. Create password reset token.
6. Create password reset link with userId
and token
7. Send email with password reset link
Password Reset - 5 Steps
www.ManzoorTheTrainer.com
1. Create ResetPasswordViewModel.
2. Create action to render reset
password form using UserId and
token.
3. Create an action to handle reset
password.
4. Find user by UserId.
5. Finally reset the password using user,
token and new password
Authorization - 5 Steps
www.ManzoorTheTrainer.com
Read Operation
jQuery Based Ajax Call
www.ManzoorTheTrainer.com
Delete Operation
jQuery Based Ajax Call
www.ManzoorTheTrainer.com
Update Operation
jQuery Based Ajax Call
www.ManzoorTheTrainer.com
Create Operation
www.ManzoorTheTrainer.com
Thanks