The GYM Management System is a complete console-based application written in C# with Entity Framework Core and QuestPDF integration, it manages Members, Trainers, Subscriptions, Attendance, and Payments with rich set of Reports that can be exported to PDF. The system is designed with clean separations of concerns:
- Models define domain entities and relationships.
- Services encapsulate business logic and data access.
- Screens (UI) handle all user interactions in the console.
- Helpers simplify input, validation, and formatting
This project simulates a real-world gym system with CRUD operations, event-driven notification, automated subscription checking with timers, and comprehensive reporting.
- ๐ค Manage Members (Add, View, Update, Delete, Assign Trainer, Find By Id/Phone)
- ๐งโ๐ซ Manage Trainers (Add, View, Update)
- ๐ Manage Subscriptions (Add, View, Update, Delete, Auto Renew)
- ๐ฐ Manage Payments linked to subscriptions
- ๐ Track Attendance with prevention of duplicate entries per day
- ๐ Generate rich Reports:
- Members whose subscriptions are about to expire
- Members list by trainer
- Revenue by month with breakdown (Standard, Premium, VIP)
- Most active members By Attendance
- ๐ Export reports to PDF using QuestPDF
- ๐ Event-driven Notification for:
- Subscription Added
- Subscription Ending
- Subscription About To Expire
- Attendance Recorded
- ๐ป Clean and structured Console Menus with proper formatting
/ GYM_System
โ
โโ Program.cs # Entry point -> loads MainMenuScreen
โ
โโ Data/
โ โโ AppDbContext.cs # EF Core DbContext (DbSets for all Models)
โ
โโ Models/ # Domain models
โ โโ PersonModel.cs # Base class for Member & Trainer
โ โโ MemberModel.cs # Member entity with subscriptions & attendance
โ โโ TrainerModel.cs # Trainer entity with salary & specialization
โ โโ SpecializationModel.cs # Specialization linked to Trainer
โ โโ SubscriptionModel.cs # Subscription entity with ServiceLevel & PlanType
โ โโ AttendanceModel.cs # Attendance tracking for members
โ โโ AttendanceReportModel.cs# Report model for attendance count
โ โโ PaymentModel.cs # Payment linked to subscription
โ โโ AddressModel.cs # Owned type inside Member (City, Region, Street...)
โ โโ Enums.cs # enServiceLevel, enPlanType, enStatus, enPaymentType
โ
โโ Services/ # Business logic & data access
โ โโ BaseService.cs # Generic CRUD + GetById/GetAllLazy
โ โโ MemberService.cs # Members + Delete with cascade + IsAttendanceBefore
โ โโ TrainerService.cs # Trainers CRUD
โ โโ SubscriptionService.cs # Subscriptions CRUD + OnSubscriptionAdded event
โ โโ SubscriptionChecker.cs # Timer-based subscription expiry check + events
โ โโ AttendanceService.cs # Attendance CRUD + OnAttendanceRecorded event
โ โโ PaymentsService.cs # Payments CRUD
โ โโ ReportService.cs # Queries for reports
โ โโ GymPricingService.cs # Static price calculator by ServiceLevel & PlanType
โ
โโ Screens/ # Console UI
โ โโ MainMenuScreen.cs # Main entry menu
โ โ
โ โโ Member/
โ โ โโ MembersManagementMenu.cs
โ โ โโ AddMemberScreen.cs
โ โ โโ ViewMemberScreen.cs
โ โ โโ UpdateMemberScreen.cs
โ โ โโ DeleteMemberScreen.cs
โ โ โโ FindMemberScreen.cs (Find by Id/Phone)
โ โ โโ AssignTrainerToMemberScreen.cs
โ โ โโ Attendance/
โ โ โ โโ AttendanceManagementMenu.cs
โ โ โ โโ RecordAttendanceScreen.cs
โ โ โ โโ ViewAttendanceScreen.cs
โ โ โโ Subscription/
โ โ โโ SubscriptionsManagementMenu.cs
โ โ โโ AddSubscriptionScreen.cs
โ โ โโ ViewSubscriptionsScreen.cs
โ โ โโ UpdateSubscriptionScreen.cs
โ โ โโ DeleteSubscriptionScreen.cs
โ โ โโ Payments/
โ โ โโ AddPaymentsScreen.cs
โ โ โโ ViewPaymentsScreen.cs
โ โ โโ UpdatePaymentsScreen.cs
โ โ
โ โโ Trainer/
โ โ โโ TrainersManagementMenu.cs
โ โ โโ AddTrainerScreen.cs
โ โ โโ ViewTrainersScreen.cs
โ โ โโ UpdateTrainerScreen.cs
โ โ
โ โโ Reports/
โ โโ ReportMenuScreen.cs
โ โโ ConsoleUI/
โ โ โโ ReportConsoleRenderers.cs
โ โ โโ ReportConsoleTitle.cs
โ โโ Core/
โ โ โโ ReportsCatalog.cs
โ โ โโ ReportDifinationModel.cs
โ โโ PDF/
โ โโ ReportPdfGenerator.cs
โ โโ ReportPdfRenderers.cs
โ
โโ Helper/
โ โโ CheckHelper.cs
โ โโ InputHelper.cs
โ โโ ConsoleUIHelper.cs
โ โโ NotificationHelper.cs
โ โโ PersonInputHelper.cs
โ โโ PersonDisplayHelper.cs
โ โโ MemberInputHelper.cs
โ โโ TrainerInputHelper.cs
โ โโ SubscriptionInputHelper.cs
โ โโ PaymentInputHelper.cs
โ
โโ Exceptions/ # Custom exceptions
โ
โโ Migrations/ # EF Core Migrations (InitialCreate + Snapshot)
โ
โโ README.md
- Member โ Trainer โ Many Members per Trainer
- Member โ Subscription โ One Member, Many Subscriptions
- Member โ Attendance โ One Member, Many Attendance Records
- Subscription โ Payment โ One-to-One (each subscription has one payment)
- Trainer โ Specialization โ One-to-One
Trainer 1 โโ * Member 1 โโ * Subscription 1 โโ 1 Payment
โ
โโโ * Attendance
- Id, FullName, Phone, Email
- DateOfBirth
- Address (City, Region, Street, Building)
- TrainerId, Trainer
- ICollection
- ICollection
- Id, FullName, Phone, Email
- Salary
- Specialization
- ICollection
- Id
- cDateSubscription (StartDate, EndDate)
- ServiceLevel (Standard, Premium, VIP)
- PlanType (Monthly, Yearly)
- Price
- Status (Active, Inactive)
- IsAutoRenew
- MemberId, Member
- Payment
- Id
- Date
- PaymentType (Cash, Card)
- Amount
- SubscriptionId, Subscription
- Id
- Date
- MemberId, Member
- Id
- Name
- TrainerId, Trainer
- City, Region, Street, Building
- MemberName
- AttendanceCount
- BaseService โ Generic CRUD operations
- MemberService โ Delete with cascade (Attendance + Subscriptions), check duplicate attendance
- TrainerService โ Manage trainers
- SubscriptionService โ Add/Delete subscriptions, fire OnSubscriptionAdded event
- SubscriptionChecker โ Timer-based checker for expiring subscriptions (fires OnSubscriptionEnd & OnSubscriptionAboutToExpire)
- AttendanceService โ Add attendance, fire OnAttendanceRecorded event
- PaymentsService โ Manage subscription payments
- ReportService โ Build datasets for reports (expiring, by trainer, revenue, attendance)
- GymPricingService โ Calculate price by ServiceLevel & PlanType
Main Menu
โโ Manage Members
โ โโ Add / View / Update / Delete
โ โโ Assign Trainer
โ โโ Find by Id/Phone
โ โโ Manage Attendance
โ โโ Record Attendance
โ โโ View Attendance
โ โโ Manage Subscriptions
โ โโ Add / View / Update / Delete
โ โโ Manage Payments (Add/View/Update)
โ
โโ Manage Trainers (Add / View / Update)
โโ Reports (4 types with Console + PDF)
โโ Exit
# 1. Clone the repository
git clone https://github.com/Kenzy-Ragab/Gym-Management-System
cd Gym-Management-System
# 2. Apply EF migrations
dotnet ef database update
# 3. Build & run the project
dotnet run
# 4. Navigate the console menus ๐ and explore features- C# .NET 8
- Entity Framework Core 9
- QuestPDF (report PDF generation)
- SQL Server (EF migrations)
- Console Application
Example: of Console Menu
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MAIN MENU โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ[1] Manage Members โ
โ[2] Manage Attendance โ
โ[3] Manage Subscriptions โ
โ[4] Manage Trainers โ
โ[5] Reports โ
โ[6] Exit โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Example: View Trainers Screen
โโโโฌโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ
โIDโ Full Name โ Phone โ Email โ Salary โ Specialization โ
โโโโผโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโค
โ 1โ Malak Ahmed โ 0123456789 โ [email protected] โ 8000 โ Cardio โ
โโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
Example: Revenue in Specific Month (Console)
==========================================
REVENUE โ MONTH September
==========================================
Service Level | Revenue
------------------------------------------
Standard | $1,500.00
Premium | $3,200.00
VIP | $5,000.00
------------------------------------------
Generated also as PDF:
Revenue_Month_5.pdf
Add Subscription Flow:
- Select Add Subscription
- Choose member
- Enter start date
- Choose service level & plan type
- System auto-calculates end date, price, and status
- Subscription saved & OnSubscriptionAdded event triggered
- Structuring large console applications with clear separation of concerns
- Using Entity Framework Core for data persistence & relationships
- Handling events in C# (delegates for subscription/attendance notifications)
- Implementing timers for background checks (subscription expiry)
- Generating professional PDF reports with QuestPDF
- Designing clean console UI with formatted tables
- ๐ Add GUI (WinForms/WPF/Blazor)
- ๐ก Add Authentication & Roles (Admin, Trainer, Member)
- โ๏ธ Host with real SQL Server / Cloud DB
- ๐ฑ Mobile app integration
- ๐ Advanced analytics (attendance trends, revenue forecast)
- ๐ Email/SMS notifications instead of console only
๐ Task Requirement (Google Drive)
Made with โค๏ธ by Kenzy Ragab
Feel free to fork, use, or contribute to this project!