School Management System API
Built with [Link] Core 8
Entity Framework Core
SQL Server
JWT Authentication
Author: Saeed Qamar
Date: April 23, 2025
Sample project demonstrating REST API development capabilities
Project Overview
A backend REST API built to manage school operations including students, teachers,
classes/sections, courses, attendance, results, and fee management. The API is designed for
web and mobile front-ends and is delivered with full OpenAPI/Swagger documentation.
Tech stack
• Layer — Technology
• Framework — [Link] Core 8
• Language — C#
• Database — SQL Server
• ORM — Entity Framework Core
• Authentication — JWT Bearer Tokens ([Link] Identity)
• Documentation — Swagger / OpenAPI
• Architecture — Clean Architecture (Controllers → Services / Repositories)
What it does
• Authentication: Issues JWT tokens; Admins create users and Teachers can be linked to
identity accounts.
• Terms & TermMonths: Manage academic terms and months used for scheduling and
results.
• Admissions & Students: Admissions lifecycle and student management (search, filter,
pagination, image upload).
• Classes / Courses / CurrentClass: Manage classes, courses and class assignments.
• Attendance: Record student attendance with unique per-day constraints.
• Results / StudentMarks: Store monthly and terminal marks with DB-level uniqueness.
• Fee Management: Manage fee types, dues, payments and payment details.
Database Schema
FeeTypes FeeSettings
FeeTypeID FeeSettingsId
Name LateFeeAmount
Description AdmissionFeeAmount
CreatedAt CardFeeAmount
ModifiedAt UpdatedAt
TerminalResults
TerminalResultID
TermID
CurrentClassID
StudentID
Month3TestID
Month1TestID
IncludeMonth1
Month2TestID
IncludeMonth2
CreatedOn
UpdatedOn
Percentage
Result
CurrentClasses TotalMarksConsidered
CurrentClassID
ClassID
SlotID
TeacherID
SessionID
StudentAttendances
StudentAttendanceID
TermID
AttendanceDate
CreatedOn
CurrentClassID
IsActive
StudentID
Status
MarkedByTeacherID
CreatedOn
UpdatedOn
Sections
SectionID
Name
TermID
Teachers
TeacherID
Serial
RegistrationNo
TeacherName
FatherName
Gender
DateOfBirth
Address
City
Region
EmergencyContact
Contact
FatherOccupation
Qualification
Admissions
AdmissionID
Institute StudentID
Cnic RegistrationDate ClassStudents
ClassStudentID
Picture CourseID
CurrentClassID
Experience LeavingDate
StudentID
CreatedAt
Status
ModifiedAt
Status
IsActive
TeacherCourses
TeacherCourseID MonthlyFee
TeacherID
CourseID Students
StudentID
CourseIsTaken
Sessions FromDate
Serial
SessionID RegDate
SessionName
ToDate FeeDues RegistrationNo
FeeDueId
SessionStartDate StudentName
AdmissionId
SessionEndDate FatherName
FeeType
IsActive Gender
FeeMonth
DateOfBirth
Courses BaseAmount
CourseID VillageID
LateFeeAmount
CourseName Address
DueDate
CourseDescription City
IsLateFeeWaived
Slots CourseStatus
Status
FatherContact
SlotID StudentContact
SlotName FatherOccupation
StartTime Qualification
EndTime Institute
TermID FatherCnic
CourseID
Classes PaymentDetails
ClassID PaymentDetailId Picture
SessionID CreatedAt
ClassName PaymentId
CourseID FeeDueId
PaidAmount
Village
VillageID
Term
TermID
Payments
TermName PaymentId
TermStart StudentId
TermEnd TotalAmount
TermDuration PaymentDate
IsActive PaymentMethod
Remarks
TermMonthPassingMarks
TermMonthPassingMarkID
TermMonthID
PassingMarks
CurrentClassID
TermID
StudentMarks
Tests StudentMarkID
TestID
ObtainedMarks
TermMonthID
TestID
TestType
StudentID
TotalMarks
TermID
CurrentClassID
Percentage
TermID
TotalMarks
StudentMonthlyResults
StudentMonthlyResultID
TermID
CurrentClassID
TermMonthID
StudentID
TotalMarks
ObtainedMarks
Percentage
CreatedOn
TermMonths
TermMonthID
TermMonth
AspNetUserTokens
UserId
LoginProvider
Name
Value
AspNetRoles AspNetUsers
Id AspNetUserRoles Id
Name UserId UserName
NormalizedName RoleId NormalizedUserName
ConcurrencyStamp Email
NormalizedEmail AspNetUserClaims
EmailConfirmed Id
PasswordHash UserId
SecurityStamp ClaimType
ConcurrencyStamp ClaimValue
AspNetRoleClaims PhoneNumber
Id PhoneNumberConfirmed
RoleId TwoFactorEnabled
ClaimType LockoutEnd
ClaimValue LockoutEnabled
AccessFailedCount
AspNetUserLogins
LoginProvider
ProviderKey
ProviderDisplayName
UserId
• Students, Teachers, Classes, ClassStudents, Courses, CurrentClasses, Sections
• StudentAttendance, StudentMarks, StudentMonthlyResult, TerminalResult
• Admissions, Term, TermMonths
• FeeTypes, FeeDues, Payments, PaymentDetails, FeeSettings
• Village, Slots, Sessions, Tests, TermMonthPassingMark
Authentication Flow
Flow Diagram
Role Access Table
• Admin — Full access to all endpoints.
• Teacher — Own classes, attendance, grades (scoped by teacher↔user link).
• Student — Own profile, grades, schedule (read access).
API Endpoints Table
Method Endpoint Description Auth Role
Required
POST /api/Auth/Login Login and receive JWT Public
token
POST /api/Auth/Register Register new identity Admin
user (Admin-only)
POST /api/Auth/RegisterTeacher Create teacher credentials Admin
and link to teacher record
GET /api/AdminTerm Get all academic terms Admin
POST /api/AdminTerm Create a term Admin
DELETE /api/AdminTerm/{id} Delete a term Admin
GET /api/AdminAdmissions Get admissions Admin
POST /api/AdminAdmissions Create admission Admin
GET /api/AdminClasses Get classes Admin
POST /api/AdminClasses Create class Admin
Sample Request & Response
Example 1 — Login Request
POST /api/Auth/Login
Content-Type: application/json
{
"username": "admin@[Link]",
"password": "Admin@123"
}
Response:
{
"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Example 2 — Get AdminTerms
GET /api/AdminTerm
Authorization: Bearer {token}
Response (HTTP 200)
[
{
"termID": "c0a80123-0000-0000-0000-000000000001",
"termName": "Spring 2026",
"termStart": "2026-01-01T00:00:00",
"termEnd": "2026-04-30T00:00:00",
"termDuration": "4 months",
"isActive": true
}
]
Error Handling
HTTP Status Meaning When It Happens
200 OK Success Request completed successfully
201 Created Resource created POST success
400 Bad Request Validation failed Missing/invalid input
401 Unauthorized Not authenticated No token or invalid token
403 Forbidden Not authorized Valid token but insufficient role
404 Not Found Resource missing Item does not exist
500 Internal Server Error Server error Unexpected exception
Project Structure