ASP.NET Core MVC CRUD + EF Core Relationships & SelectList | .NET Course – Week 10 Class 1
Code Eat Sleep Repeat
0:00 / 0:00
ASP.NET Core MVC CRUD + EF Core Relationships & SelectList | .NET Course – Week 10 Class 1
25 просмотров · 2 недели назад
Code Eat Sleep Repeat
299 подписчиков
25 просмотров · 2 недели назад
Welcome to Week 10, Class 1 of the .NET Development Course!
In this class, we continue building our real Academy Management System and focus completely on practical ASP.NET Core MVC development.
We first complete the remaining Department CRUD functionality and then start the Course module, where students learn how to work with real Entity Framework Core relationships, navigation properties, Include(), and dropdowns using SelectList.
✅ Department Module Topics Covered:
Department Create POST
Model Binding
ModelState.IsValid
Saving records with EF Core
Add()
SaveChangesAsync()
Post/Redirect/Get pattern
Preventing duplicate Departments
AnyAsync()
Adding custom ModelState errors
Department Details
FindAsync()
NotFound()
Department Edit GET
Pre-populating Edit forms
Department Edit POST
Updating database records
Department Delete confirmation
Safe Delete POST
Remove()
Anti-forgery protection
Foreign Key delete restrictions
Complete CRUD testing
Verifying records directly in SQL Server
✅ Course Module Topics Covered:
Department to Course relationship
One-to-Many relationship
Foreign Key properties
Navigation Properties
Reviewing the Course Entity
Creating CoursesController
Injecting ApplicationDbContext
Loading Courses from the database
Introduction to Include()
Loading related Department data
EF Core Include() vs SQL JOIN
Displaying Department Name instead of DepartmentId
Building the Course Index page
Creating Course GET action
Department dropdown
Introduction to SelectList
Dropdown display text vs stored value
Using asp-for
Using asp-items
Course Create POST
Saving Foreign Key values
Re-populating dropdowns after validation errors
Testing relational records
Verifying Course data in SQL Server
One of the most important concepts in this class is understanding how relational data works inside a real ASP.NET Core MVC application.
Instead of showing:
DepartmentId = 1
our application loads and displays:
Software Development
using the Foreign Key, Navigation Property, and EF Core Include().
Students also learn how a dropdown can display a readable Department name while storing the actual DepartmentId in SQL Server.
The complete relationship becomes:
Department → Course
and the application flow becomes:
Razor View → Controller → EF Core → SQL Server → Related Data → View
💡 Make sure you test the complete Department CRUD flow first, then create multiple Courses under different Departments and verify both the MVC screens and SQL Server records.
Course: .NET Development Course
Week: 10
Class: 1
Project: Academy Management System
Topics: Department CRUD, Course Module, EF Core Relationships, Include & SelectList
Tools: ASP.NET Core MVC, Entity Framework Core, SQL Server, Razor Views, Git & GitHub
If you find this class helpful, please Like, Share & Subscribe for more C#, SQL Server, ASP.NET Core MVC, Entity Framework Core, Git, GitHub, Codex, and real-world .NET development tutorials.