This document outlines the plan and process for building a web application using ASP.NET MVC 3-tier architecture. It describes requirements for a link sharing portal, defines user and admin roles, designs the database schema and business objects, and outlines the controller and view logic for the user interface. Implementation steps include creating the data access layer, business logic layer, and MVC presentation layer to build out features like user registration, link submission, category management, and authentication.
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
3-TIER ARCHITECTURE IN ASP.NET MVC
1. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Live Project - Web App
on Asp.Net MVC
- Mohd Manzoor Ahmed (MCTS, MCPD & MCT)
www.manzoorthetrainer.com
2. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Project Plan
● Understanding Requirements and Database Design.
● Creating Solution and Adding projects to It.
● Creating The business Objects.
● Creating Data Access Layer in EF.
● Creating Business Logic Layer in C#.Net.
● Creating Presentation Logic Layer in MVC5.
● Designing Models, Controllers and Views.
● Business Rules Validations.
● Securing Your App.
● Implementing Transactions.
● Ajaxifying Your App.
● Conclusion And Feedback
3. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Finalized Requirements
Link hub is a web portal where a user can submit their portal URL under a
specific category to be shared on link hub. Admin can approve or reject the
URL submitted by the user and in each case an email is sent out to the
user. Once the link is approve it will be available on the link hub portal
under a specific category.
4. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Defining the Roles &
Responsibilities
Roles:
• User
o Can Browse URLs
o Can Register
o Can Submit A URL
• Admin
o Can CRUD Category
o Can View All Users
o Can ApproveOrReject URL
6. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The Relationships
• Category : Url
1--------------------> n
n--------------------> 1 (X)
n--------------------> n (X)
o (1:M)
7. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The Relationships
• User : Url
1--------------------> n
n--------------------> 1 (X)
n--------------------> n (X)
o (1:M)
8. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The Relationships
• Objects
o User
o Category
o Url
• Relationships
o Category : Url
(1:M)
o User : Url
(1:M)
9. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
3 Key Rules For Database
Design
1. One table for each object
2. For 1:M relationship. 1 will become master and M will become child i.e.,
primary key of 1 will act as a foreign key for M.
Eg:Department : Employees is 1 : M
Department Table
Did
DName
Description
Employee Table
Eid
EName
ESalary
Did
10. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
3 Key Rules For Database
Design
3. M:M relationship. Both the objects will become master and there will be
one more new table called as transaction table or child table with primary
keys of masters as foreign Keys in it.
Eg:Student : Course is M : M
Student Table
Sid
SName
SAddress
Course Table
Cid
CName
Description
Student_Course Table
SCId
Sid
Cid
13. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Inserting Dummy Records
Lets go and Insert dummy and meaningful records
14. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Design Project Arch.
DAL
Ado.Net
EF
Result c
BLL
C#.Net
c=a+b
UI
Asp.Net
MVC
a=10;
b=20;
show c
Database
MS SQL
Business Objects (BO)
16. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Solution and
Adding projects to It
Lets go and implement it
17. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business
Objects
Basically a business object layer contains classes equivalent to the tables i.e.,
one class for each table.
Eg:If I have a department table
tbl_Department (Relation)
Did
DName
Description
Object
class tbl_Department
{
Public int Did {get;set;}
Public string DName {get;set;}
Public string Description {get;set;}
}
i.e., O/R M
Lets go and implement it
18. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business
Objects - Relationship(1:M)
Object
class tbl_Deptartment
{
public int Did {get;set;}
public string DName {get;set;}
public string Description {get;set;}
public virtual List<tbl_Employee>
tbl_Employees {get;set;}
}
tbl_Department
Did
DName
Description
tbl_Employee
Eid
EName
ESalary
Did
Object
class tbl_Employee
{
public int Eid{get;set;}
public string EName {get;set;}
public double Esalary {get;set;}
public int Did{get;set;}
public virtual tbl_Department {get;set;}
}
19. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business
Objects - Relationship(M:M)
tbl_Student
Sid
SName
SAddress
tbl_Course
Cid
CName
Description
tbl_Student_Course
SCId
Sid
Cid
20. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business
Objects - Relationship(M:M)
Object
class tbl_Student
{
public int Sid{get;set;}
public string SName {get;set;}
public string Address {get;set;}
public virtual List<tbl_Student_Course>
tbl_Student_Courses {get;set;}
}
Object
class tbl_Course
{
public int Cid{get;set;}
public string CName {get;set;}
public string CDescription {get;set;}
public virtual List<tbl_Student_Course>
tbl_Student_Courses {get;set;}
}
Object
class tbl_Student_Course
{
public int SCid{get;set;}
public int Sid {get;set;}
public int Cid {get;set;}
public virtual tbl_Student {get;set;}
public virtual tbl_Course {get;set;}
}
21. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Of UI/PL
DAL
Ado.N
et
EF
Result
c
BLL
C#.Net
c=a+b
UI
Asp.Net
a=10;
b=20;
show c
Database
MS SQL
Business Objects (BO)
Database
MS SQL
Business Objects (BO)
UI
Asp.Net
MVC
a=10;
b=20;
show c
22. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Roles & Responsibilities
Roles:
• User
o Can Browse URLs
o Can Register
o Can Submit A URL
• Admin
o Can CRUD Category
o Can View All Users
o Can ApproveOrReject URL
32. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
UI - Modules
• User
o SubmitURL
• Admin
o Category
o ListCatergories
o ListUsers
o ApproveURLs
• Common
o Home
o BrowseURLs
• Security
o Login
o Register
40. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Common Controllers
Design
Controller Action
Home Index [Display Calender - HttpGet]
BrowseURLs Index [Display List Form - HttpGet]
46. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Data Access
Layer
Lets go and implement it
47. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Business Logic
Layer
Lets go and implement it
48. www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Of UI/PL
DAL
Ado.Net
Result c
BLL
C#.Net
c=a+b
UI
Asp.Net
a=10;
b=20;
show c
Database
MS SQL
Business Objects (BO)
Database
MS SQL
Business Objects (BO)
UI
Asp.Net
a=10;
b=20;
show c
BLL
C#.Net
c=a+b
DAL
Ado.Net
Result c