Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

School Management System - Clean Architecture Backend

Project Structure

SchoolManagement/
├── Domain/                      # Domain Layer (Entities)
│   └── Entities/
│       └── Class.cs
│       └── Student.cs
├── Application/                 # Application Layer (Business Logic)
│   ├── DTOs/
│   │   └── Dtos.cs
│   ├── Interfaces/
│   │   ├── IRepositories.cs
│   │   └── IServices.cs
│   └── Services/
│       └── Services.cs
├── Infrastructure/              # Infrastructure Layer (Data Access)
│   ├── Data/
│   │   └── ApplicationDbContext.cs
│   └── Repositories/
│       └── Repositories.cs
├── Presentation/                # Presentation Layer (Controllers)
│   └── Controllers/
│       └── Controllers.cs
├── Program.cs                   # Application Entry Point
├── appsettings.json
└── appsettings.Development.json

Features

Classes Management

  • GET /api/classes - Get all classes
  • GET /api/classes/{id} - Get class details
  • POST /api/classes - Create new class

Students Management

  • GET /api/students - Get all students
  • GET /api/students/{id} - Get student details
  • POST /api/students - Add new student
  • PUT /api/students/{id} - Update student
  • DELETE /api/students/{id} - Delete student

Architecture Layers

  1. Domain Layer: Contains entities (Class, Student)
  2. Application Layer: Contains business logic (Services), DTOs, and interfaces
  3. Infrastructure Layer: Contains data access logic (DbContext, Repositories)
  4. Presentation Layer: Contains API Controllers

Request Flow

Client (Postman) 
    ↓ 
Controller (Presentation Layer)
    ↓ 
Service (Application Layer - Business Logic)
    ↓ 
Repository (Infrastructure Layer - Data Access)
    ↓ 
Database (In-Memory EF Core)

Getting Started

Prerequisites

  • .NET 8.0 SDK
  • Visual Studio Code or Visual Studio

Installation

  1. Navigate to project directory:
cd d:\backend
  1. Restore dependencies:
dotnet restore
  1. Run the application:
dotnet run
  1. Access Swagger UI at: https://localhost:5001/swagger

API Examples

Create a Class

POST /api/classes
Content-Type: application/json

{
  "name": "10A",
  "description": "Grade 10 Class A"
}

Create a Student

POST /api/students
Content-Type: application/json

{
  "fullName": "Nguyen Van A",
  "email": "nguyenvana@example.com",
  "dateOfBirth": "2008-01-15",
  "classId": 1
}

Get All Classes

GET /api/classes

Update Student

PUT /api/students/{id}
Content-Type: application/json

{
  "fullName": "Nguyen Van A Updated",
  "email": "newemail@example.com",
  "dateOfBirth": "2008-01-15",
  "classId": 1
}

Delete Student

DELETE /api/students/{id}

Database Schema

Classes Table

Column Type Description
Id int (PK) Class ID
Name varchar Class Name
Description varchar Class Description

Students Table

Column Type Description
Id int (PK) Student ID
FullName varchar Student Full Name
Email varchar Student Email
DateOfBirth date Date of Birth
ClassId int (FK) Class Reference

Notes

  • Using EF Core In-Memory Database for data persistence
  • All relationships are configured with cascade delete
  • CORS is enabled for all origins
  • Swagger/OpenAPI documentation is available in development environment

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages