0% found this document useful (0 votes)
7 views18 pages

Dept Student Create

The document outlines the steps to create a web application with departments and students using ASP.NET MVC. It includes instructions for adding models, setting up the database context, creating migrations, and generating controllers with views for both Dept and Student. Additionally, it mentions the need to redesign the Create.cshtml files for both models and create a StudentViewModel.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views18 pages

Dept Student Create

The document outlines the steps to create a web application with departments and students using ASP.NET MVC. It includes instructions for adding models, setting up the database context, creating migrations, and generating controllers with views for both Dept and Student. Additionally, it mentions the need to redesign the Create.cshtml files for both models and create a StudentViewModel.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Create.

cshtml
Dept and Student
1) Add Dept and Student
class to Models Folders
Dept

Id: int
Dname: string?
Faculty: string?

Student
Id: int
Sname: String?
Gender: String?
Total: int
Email: string?
Password: string?
Simage : string?
2) ApplicationDbContext
3) Program.cs
4) Migration
• Tools  Nuget Package Manager  Package Manager Console
• Add-Migration step1
• Update-Database
5) Add Controller with View using EF

(Dept / Student)
• Controllers  Add  Controller
• MVC Controller with Views using EF
• Model Name : Dept
• DBContext: ApplicationDBContext
• Controller Name : DeptsControllers (by Default)
• Add

• Controllers  Add  Controller


• MVC Controller with Views using EF
• Model Name : Student
• DBContext: ApplicationDBContext
• Controller Name : StudentsControllers (by Default)
• Add
Run Project
• Http://localhost....../Depts/index
• Http://localhost....../Students/index
Depts.Create.cshtml

Database

2
Create.cshtml

Design

DeptControllers
Dept Page
Depts.Index Depts.Create
Part 2: Create.cshtml (Student)
Create.cshtml (Structure)

Student

Database
2

StudentViewModel

1
1) Create new Class (Models)
StudentViewModel
2) re-Design Create.cshtml
2) re-Design Create.cshtml
2) re-Design Create.cshtml
3) studentsControllers
Index

You might also like