Skip to content

Kenzy-Ragab/Course-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ Course Management System (Console App)

A clean, interactive C#/.NET console application for managing Students, Instructors, Courses, Categories, and Enrollments with Entity Framework Core (SQL Server LocalDB). It demonstrates real-world CRUD, 1-N and N-N relationships (via a join entity), and LINQ-based reports โ€” all through a structured, friendly terminal UI.


๐Ÿ“ Description

This project is a modular console app that simulates a mini learning platform back office. It covers the full flow:

  • Create Categories โžœ add Instructors โžœ add Courses โžœ manage Students โžœ Enroll students โžœ generate Reports โ€” with consistent menus, validation helpers, and a reusable reporting printer.

โœจ Features

  • โž• CRUD for Students, Instructors, Categories, and Courses
  • ๐Ÿงพ Enroll students into courses (prevents duplicate enrollments)
  • ๐Ÿ“Š Reports:
    • Courses with their instructors
    • Enrollment count per course
    • Students with their courses
    • Course (by ID) with enrolled students
    • Top 3 courses by enrollments
  • ๐Ÿ”Ž Query helper: Get courses under a specific price (service-level)
  • ๐Ÿงฑ Separation of concerns: Models, Services, Screens, Helpers, Data
  • ๐Ÿงฐ Generic base service for common CRUD with EF Core
  • ๐Ÿงฏ Graceful console messages + minimal error handling on SaveChanges()

๐Ÿ—‚๏ธ Project Structure

CourseManagementSystem/
โ”œโ”€โ”€ Data/
โ”‚   โ””โ”€โ”€ AppDbContext.cs              # EF Core DbContext + relationships
โ”œโ”€โ”€ Helpers/
โ”‚   โ”œโ”€โ”€ ConsoleUIHelper.cs           # Boxed menus, prompts
โ”‚   โ””โ”€โ”€ InputHelper.cs               # Input validation (int/decimal/string)
โ”œโ”€โ”€ Migrations/                      # EF Core migrations + snapshot
โ”œโ”€โ”€ Models/
โ”‚   โ”œโ”€โ”€ CategoryModel.cs
โ”‚   โ”œโ”€โ”€ CourseModel.cs
โ”‚   โ”œโ”€โ”€ EnrollmentModel.cs
โ”‚   โ”œโ”€โ”€ InstructorModel.cs
โ”‚   โ””โ”€โ”€ StudentModel.cs
โ”œโ”€โ”€ Screens/
โ”‚   โ”œโ”€โ”€ Category/
โ”‚   โ”‚   โ”œโ”€โ”€ AddCategoryScreen.cs
โ”‚   โ”‚   โ”œโ”€โ”€ CategoryMenuScreen.cs
โ”‚   โ”‚   โ””โ”€โ”€ ViewCategoriesScreen.cs
โ”‚   โ”œโ”€โ”€ Course/
โ”‚   โ”‚   โ”œโ”€โ”€ AddCourseScreen.cs
โ”‚   โ”‚   โ”œโ”€โ”€ CourseMenuScreen.cs
โ”‚   โ”‚   โ”œโ”€โ”€ UpdateCourseScreen.cs
โ”‚   โ”‚   โ””โ”€โ”€ ViewCourseScreen.cs
โ”‚   โ”œโ”€โ”€ Instructor/
โ”‚   โ”‚   โ”œโ”€โ”€ AddInstructorScreen.cs
โ”‚   โ”‚   โ”œโ”€โ”€ InstructorMenuScreen.cs
โ”‚   โ”‚   โ””โ”€โ”€ ViewInstructorsScreen.cs
โ”‚   โ”œโ”€โ”€ Reports/
โ”‚   โ”‚   โ”œโ”€โ”€ ReportPrinter.cs
โ”‚   โ”‚   โ”œโ”€โ”€ ReportsMenuScreen.cs
โ”‚   โ”‚   โ””โ”€โ”€ ReportsRenderingMethodsScreen.cs
โ”‚   โ””โ”€โ”€ Student/
โ”‚       โ”œโ”€โ”€ AddStudentScreen.cs
โ”‚       โ”œโ”€โ”€ DeleteStudentScreen.cs
โ”‚       โ”œโ”€โ”€ EnrollStudentScreen.cs
โ”‚       โ”œโ”€โ”€ StudentMenuScreen.cs
โ”‚       โ”œโ”€โ”€ UpdateStudentScreen.cs
โ”‚       โ””โ”€โ”€ ViewStudentsScreen.cs
โ”œโ”€โ”€ Services/
โ”‚   โ”œโ”€โ”€ BaseService.cs
โ”‚   โ”œโ”€โ”€ CategoryService.cs
โ”‚   โ”œโ”€โ”€ CourseService.cs
โ”‚   โ”œโ”€โ”€ EnrollmentService.cs
โ”‚   โ”œโ”€โ”€ InstructorService.cs
โ”‚   โ”œโ”€โ”€ ReportService.cs
โ”‚   โ””โ”€โ”€ StudentService.cs
โ””โ”€โ”€ Program.cs

๐Ÿงฉ Models & Relationships

Category (1) โ”€โ”€โ”€ (โˆž) Course (โˆž) โ”€โ”€โ”€  (โˆž) Student    via Enrollment 
                    โ”‚
                    โ””โ”€โ”€ (1) Instructor
  • Many-to-Many between Student and Course inplemented via Enrollment join table
  • One-to-Many: Instructor -> Courses, Category -> Courses
  • Relationships configured in AppDbContext.OnModelCreating(โ€ฆ).

๐Ÿงพ Properties of Models

  • StudentModel
    • int Id, string FullName, string Email
    • ICollection<EnrollmentModel> Enrollments
  • InstructorModel
    • int Id, string FullName, string Email
    • ICollection<CourseModel> Courses
  • CategoryModel
    • int Id, string Name
    • ICollection<CourseModel> Courses
  • CourseModel
    • int Id, string Title, string Description, decimal Price
    • int InstructorId, InstructorModel Instructor
    • int CategoryId, CategoryModel Category
    • ICollection<EnrollmentModel> Enrollments
  • EnrollmentModel
    • int Id
    • int StudentId, StudentModel Student
    • int CourseId, CourseModel Course

๐Ÿง  Services Overview

  • BaseService
    • Add(T entity), Update(T entity), T? GetById(int id), List<T> GetAll()
  • StudentService : BaseService
    • Delete(int id) โžœ removes student + their enrollments
    • GetStudentsWithoutCourses()
  • InstructorService : BaseService
  • CategoryService : BaseService
  • CourseService : BaseService
    • GetCoursesUnderPrice(decimal maxPrice) โžœ { Title, Price }
  • EnrollmentService : BaseService
  • ReportService
    • GetCoursesWithInstructors() โžœ { Title, InstructorName }
    • GetEnrollmentsCount() โžœ { Title, StudentCount }
    • GetStudentsWithCourses() โžœ StudentModel + Enrollments.Course
    • GetCourseWithStudents(int id) โžœ CourseModel + Enrollments.Student
    • GetTop3CoursesByEnrollments() โžœ { Title, Count }

๐Ÿงญ Console Flow

[MAIN MENU]
  1) Student Menu
  2) Category & Instructor Management
  3) Course Menu
  4) Reports Menu
  5) Exit

Recommended workflow

  1. Add Category โ†’ 2. Add Instructor โ†’ 3. Add Course
  2. Add Student โ†’ 5. Enroll Student in Course โ†’ 6. Run Reports

๐Ÿš€ Quick Start

# 1) Clone
git clone https
cd CourseManagementSystem

# 2) Ensure .NET SDK & EF Tools
dotnet --version
dotnet tool install --global dotnet-ef

# 3) Apply EF Core migrations (SQL Server LocalDB)
dotnet ef database update

# 4) Run
dotnet run

Connection string lives in AppDbContext.OnConfiguring (LocalDB):
Server=(localdb)\mssqllocaldb;Database=CourseManagementSystem;Trusted_Connection=True;
You can adapt it for a full SQL Server instance if needed.


๐Ÿงฐ Teck Stack

  • ๐Ÿงฑ C# .NET (Console App)
  • ๐Ÿ—„๏ธ Entity Framework Core (with Migrations)
  • ๐Ÿ˜ SQL Server LocalDB
  • ๐Ÿงฎ LINQ queries + Include/ThenInclude
  • ๐Ÿ–ฅ๏ธ Console UI with boxed menus & validated input
  • ๐Ÿงฉ Clean separation across Data/Models/Services/Screens/Helpers

๐Ÿ‘€ Preview

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                MAIN MENU                 โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘[1] Student Menu                          โ•‘
โ•‘[2] Category & Instructor Management      โ•‘
โ•‘[3] Course Menu                           โ•‘
โ•‘[4] Reports Menu                          โ•‘
โ•‘[5] Exit                                  โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
-> Select an option:

Sample โ€œView Studentsโ€ table

โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ID โ”‚        Full Name           โ”‚              Email                 โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  1 โ”‚ Mohamed Ahmed              โ”‚ mohamed@gmail.com                  โ”‚
โ”‚  2 โ”‚ Maria Amr                  โ”‚ maria@gmail.com                    โ”‚ 
โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Report: Top 3 Courses by Enrollments

TOP 3 COURSES BY ENROLLMENTS
---------------------------------------------
Course Title                  |  Enrollments
---------------------------------------------
C# Fundamentals               |           12
SQL for Beginners             |            9
ASP.NET Core Essentials       |            7
---------------------------------------------

๐Ÿงช Example

# Add a Category
[Category Menu] -> Add Category
-> Enter Category Name: "Programming"

# Add an Instructor
[Instructor Menu] -> Add Instructor
-> Full Name: "Dr. Mostafa Saad"
-> Email: "mostafasaad@gamil.com"

# Add a Course
[Course Menu] -> Add Course
-> Title: "C++ Fundamentals"
-> Description: "Intro to C++"
-> Price: 1000.00
-> Instructor ID: 1
-> Category ID: 1

# Add Student
[Student Menu] -> Add Student
-> Full Name: "Mohamed Ahmed"
-> Email: "mohamed@gmail.com"

# Enroll Student
[Student Menu] -> Enroll Student in Course
-> Student ID: 1
-> Course ID: 1

# Reports
[Reports Menu] -> Enrollment count per course

๐Ÿง  What I Learned

  • Modeling 1โ€“N and Nโ€“N relationships in EF Core with a join entity
  • writing espressive LINQ queries with Include/ThenInclude for eager loading
  • Building a generic service layer to reduce CRUD relationships
  • Designing console-first UX (clear menus, aligend tables, helpful prompts)
  • Organizing a solution for maintainability (Data/Models/Services/Screens/Helpers)
  • Using migrations and LocalDB connection for quick persistence

๐Ÿ”ญ Future Enhancement

  • โœ… Use the โ€œcourses under priceโ€ query in the UI (currently implemented at service level)
  • ๐Ÿ” Search & filters (by name, price range, category) + pagination in listings
  • ๐Ÿงน Stronger input validation, domain rules, and centralized error handling
  • ๐Ÿงฑ Introduce DTOs/mappers to separate UI from EF entities
  • ๐Ÿงช Unit tests for services and helpers
  • ๐Ÿงพ Seed data for quick demos
  • โš™๏ธ Move connection string to configuration (appsettings) and support multiple environments
  • ๐Ÿ“ค Export reports to CSV/JSON
  • ๐Ÿง‘โ€๐Ÿ’ป Consider moving to a web UI (ASP.NET Core MVC/Minimal APIs) later

๐Ÿค Task Outline in Breakin Point (Student Activity)

๐Ÿ“Ž Task Outline (Google Drive)

๐Ÿ“ธ Archived Copy at submission time (Google Drive)

Made with โค๏ธ by Kenzy Ragab

Feel free to fork, use, or contribute to this project!

About

๐ŸŽ“ Console-based Course Management System built with C# and EF Core

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages