Skip to content

Repository files navigation

Gym Logo

Gym Management System

Full-Stack Web Application · ASP.NET Core MVC · Layered Architecture


.NET 8 C# ASP.NET Core MVC EF Core SQL Server Bootstrap

GitHub repo size GitHub last commit GitHub stars License: MIT


A comprehensive gym management platform with member registration, trainer management, session scheduling, membership plans, booking workflows, health records, analytics dashboard, and file attachment support — built on a strict three-layer architecture separating UI, business logic, and data access.


🚀 Quick Start · 🐛 Report Bug · 💡 Request Feature



📑 Table of Contents

Click to expand


⚡ Highlights

👥 Member Management Complete CRUD operations for gym members with profile photos (file upload), personal info, gender, and linked health records with BMI, blood pressure, and medical notes.

🏋️ Trainer Management Full trainer profiles with specialties (Fitness, Yoga, CrossFit, Bodybuilding), certifications, photo uploads, and linked session assignments.

📅 Session Scheduling Create, edit, and manage gym sessions — each linked to a trainer, category, time slot, capacity, and location. Tracks session status (Upcoming, Ongoing, Completed).

📋 Booking System Book members into sessions with capacity tracking. View member lists for upcoming and ongoing sessions. Manage member-session relationships via a many-to-many join.

💳 Membership & Plans Create subscription plans with pricing, duration, and descriptions. Assign members to plans with start/end dates. Track membership histories per member.

📊 Analytics Dashboard Overview page with total counts for members, trainers, sessions, and plans — giving managers a quick operational snapshot.

🏗️ Layered Architecture (PL / BLL / DAL) Three dedicated projects with strict separation — swap your data layer, modify business rules, or redesign the UI independently.

📦 Unit of Work + Generic Repository UnitOfWork coordinates all repositories. GenericRepository<T> provides type-safe CRUD out of the box, with specialized repos for sessions, bookings, and memberships.


🏛 Architecture Overview

The project follows a classic 3-Tier Layered Architecture:

┌─────────────────────────────────────────────────────────────┐
│                   PRESENTATION LAYER (PL)                   │
│                      GymManagementPL                        │
│    MVC Controllers · Razor Views · Static Assets · CSS      │
│    Bootstrap 5 · jQuery Validation · wwwroot                │
└────────────────────────┬────────────────────────────────────┘
                         │
┌────────────────────────▼────────────────────────────────────┐
│                 BUSINESS LOGIC LAYER (BLL)                  │
│                     GymManagementBLL                        │
│    Services · ViewModels · AutoMapper Profiles              │
│    Business Rules · Validation · Data Transformation        │
└────────────────────────┬────────────────────────────────────┘
                         │
┌────────────────────────▼────────────────────────────────────┐
│                   DATA ACCESS LAYER (DAL)                   │
│                     GymManagementDAL                        │
│    EF Core DbContext · Entities · Repositories · UnitOfWork │
│    Fluent API Configs · Migrations · Data Seeding           │
└─────────────────────────────────────────────────────────────┘

Layer Responsibilities

Layer Project Description
PL GymManagementPL 7 MVC controllers, Razor views (CRUD + Detail pages), _Layout.cshtml with navigation, Bootstrap 5 + custom CSS, static file serving, Program.cs entry point with DI configuration, auto-migration & seeding.
BLL GymManagementBLL 7 services (MemberService, TrainerService, PlanService, SessionService, MembershipService, BookingService, AnalyticsService), AttachmentService for file uploads, AutoMapper MappingProfiles, and comprehensive ViewModels for each domain.
DAL GymManagementDAL GymDbContext with Fluent API, 11+ entities (Member, Trainer, Session, Plan, MemberShip, MemberSession, Category, HealthRecord, GymUser, BaseEntity), GenericRepository<T>, specialized repositories, UnitOfWork, 9 EF Configurations, data seeding, 6 migrations.

📁 Solution Structure

GymManagementSystem/
│
├── GymManagementDAL/                  # Data Access Layer
│   ├── Entities/                      # Domain models
│   │   ├── BaseEntity.cs
│   │   ├── GymUser.cs
│   │   ├── ApplicationUser.cs
│   │   ├── Member.cs
│   │   ├── Trainer.cs
│   │   ├── Plan.cs
│   │   ├── Session.cs
│   │   ├── MemberShip.cs
│   │   ├── MemberSession.cs
│   │   ├── HealthRecord.cs
│   │   ├── Category.cs
│   │   └── Enums/
│   ├── Data/
│   │   ├── Contexts/                  # GymDbContext
│   │   ├── Configurations/            # Fluent API entity configs
│   │   ├── DataSeed/                  # GymDbContextSeeding, IdentityDbContextSeeding
│   │   └── Migrations/
│   └── Repositories/
│       ├── Interfaces/                # IGenericRepository, IUnitOfWork, ...
│       └── Classes/                   # GenericRepository, UnitOfWork, ...
│
├── GymManagementBLL/                  # Business Logic Layer
│   ├── Services/
│   │   ├── Interfaces/                # IMemberService, ITrainerService, ...
│   │   ├── Classes/                   # MemberService, TrainerService, ...
│   │   └── AttachmentService/         # File upload handling
│   ├── ViewModels/                    # Per-feature ViewModels (CRUD + Select)
│   │   ├── MemberViewModels/
│   │   ├── TrainerViewModels/
│   │   ├── SessionViewModels/
│   │   ├── PlanViewModels/
│   │   ├── MembershipViewModels/
│   │   ├── BookingViewModels/
│   │   ├── AnalyticsViewModels/
│   │   └── AccountViewModels/
│   └── MappingProfiles.cs             # AutoMapper profiles for all entities
│
└── GymManagementPL/                   # Presentation Layer
    ├── Controllers/
    │   ├── AccountController.cs
    │   ├── HomeController.cs
    │   ├── MemberController.cs
    │   ├── TrainerController.cs
    │   ├── PlanController.cs
    │   ├── SessionController.cs
    │   ├── MembershipController.cs
    │   └── BookingController.cs
    ├── Views/                         # Razor views per controller
    ├── Program.cs
    └── appsettings.json

🛠️ Tech Stack

Category Technology Purpose
Runtime .NET 8.0+ Long-term support runtime
Framework ASP.NET Core MVC Server-rendered views with Razor
Language C# 12 Primary language (50.5%)
ORM Entity Framework Core Database access, migrations & Fluent API
Database SQL Server Relational data store
Mapping AutoMapper Entity ↔ ViewModel mapping
Frontend Bootstrap 5 + Custom CSS Responsive UI (44.9% HTML, 4.5% CSS)
Validation jQuery Validation + Data Annotations Client + server-side validation
Patterns Repository, Unit of Work, DI, ViewModel, Service Layer Enterprise design patterns
Architecture 3-Tier Layered (PL / BLL / DAL) Separation of concerns

🎯 Features in Detail

👥 Members

  • Create members with name, email, phone, gender, date of birth, and profile photo upload
  • Edit and delete member profiles
  • View detailed member cards with all personal information
  • Health Records — Dedicated health tracking per member (BMI, blood pressure, height, weight, notes)
  • Health record create, view, and edit flows

🏋️ Trainers

  • Full CRUD with photo upload
  • Specialty selection: Fitness, Yoga, CrossFit, Bodybuilding
  • Certified trainer profiles with contact details

📅 Sessions

  • Create sessions with title, description, location, date/time, duration, and capacity
  • Assign a trainer and category to each session
  • Dropdown selections powered by CategorySelectViewModel and TrainerSelectViewModel
  • Session lifecycle tracking (Upcoming / Ongoing / Completed)

📋 Bookings

  • Book members into specific sessions
  • View enrolled member lists for ongoing and upcoming sessions
  • Capacity-aware booking with member-session many-to-many relationship

💳 Memberships & Plans

  • Define plans with name, price, duration, max freeze days, and description
  • Assign members to plans with start/end dates
  • View all memberships for a specific member
  • Track active vs. expired memberships

📊 Analytics Dashboard

  • At-a-glance dashboard with totals: Members, Trainers, Sessions, Plans
  • Powered by the AnalyticsService aggregation logic

🚀 Quick Start

Prerequisites

Requirement Minimum Version Download
.NET SDK 8.0 dotnet.microsoft.com
SQL Server Any recent SQL Server Downloads
Visual Studio 2022+ visualstudio.com

Step-by-Step Setup

# 1. Clone the repository
git clone https://github.com/Jaser1010/gym-management-system.git
cd gym-management-system

# 2. (Optional) Switch to the most advanced branch
git checkout Ass_5

# 3. Update connection string in appsettings.Development.json if needed

# 4. Restore packages
dotnet restore

# 5. Run (auto-migrates DB + seeds categories & plans on startup)
dotnet run --project GymManagementPL

💡 Tip: The database is automatically migrated and seeded with categories and plans from JSON files on first startup.


⚙️ Configuration

// appsettings.Development.json
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=.;Database=GymManagementDb;Trusted_Connection=True;TrustServerCertificate=True;"
  }
}

🔬 Design Patterns

Pattern Where used
Repository IGenericRepository<T> + entity-specific repositories
Unit of Work IUnitOfWork coordinates all repositories
Service Layer BLL services encapsulate all business logic
AutoMapper ViewModel ↔ Entity mapping in MappingProfiles.cs
Data Seeding GymDbContextSeeding + IdentityDbContextSeeding
Dependency Injection All services/repos registered in Program.cs

🗺️ Roadmap

✅ Completed

  • Member CRUD with profile photos and health records
  • Trainer CRUD with specialties and photos
  • Session scheduling with trainer/category assignment
  • Booking system with capacity tracking
  • Membership plans with pricing and duration
  • Analytics dashboard
  • Generic Repository + Unit of Work
  • AutoMapper integration
  • File attachment service
  • JSON-based data seeding
  • Auto DB migration
  • Bootstrap 5 responsive UI (12K+ lines of custom CSS)
  • Authentication & Authorization — ASP.NET Identity with role-based access (Admin, Trainer, Member)

🔜 Coming Soon

  • 💰 Billing & Invoicing — Payment tracking and invoice generation
  • 📧 Email Notifications — Membership renewal and session reminders
  • 📱 Responsive Improvements — Mobile-first redesign
  • 🧪 Testing Suite — Unit and integration tests
  • 🐳 Docker Support — Containerized deployment

🤝 Contributing

Contributions are welcome! Fork the repo, create a feature branch, and submit a Pull Request.

git checkout -b feature/amazing-feature
git commit -m "feat: add amazing feature"
git push origin feature/amazing-feature

📄 License

Distributed under the MIT License.


👤 Author

Jaser Kasim
Software Engineer

GitHub LinkedIn

If you found this project helpful, consider giving it a ⭐

Built with ❤️ using C# and ASP.NET Core MVC

About

Gym management web app built with ASP.NET Core MVC. Provides role-based access, CRUD for members, trainers & plans; supports session scheduling & billing; uses layered architecture with SQL Server and EF Core.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages