A comprehensive RESTful API for online examination and course management system built with ASP.NET Core 8
Features β’ Tech Stack β’ Getting Started β’ API Documentation
EduVerse Examination System is a robust and scalable web API designed to facilitate the complete lifecycle of online education - from course creation and student enrollment to exam administration and automated grading.
- Course Management: Create, update, and manage courses with instructor assignments
- Student Enrollment: Enroll students in courses and track their progress
- Exam Creation: Build comprehensive exams with multiple question types (MCQ, True/False, Essay)
- Online Testing: Students can take exams with time tracking and auto-submission
- Automated Grading: Instant grading for objective questions with manual review for subjective answers
- Assignment Management: Create and submit assignments with file attachments
- Social Learning: Timeline posts, comments, and course reviews
- Analytics & Reporting: Comprehensive exam results and performance metrics
| Technology | Version | Purpose |
|---|---|---|
| ASP.NET Core | 8.0 | Web API Framework |
| C# | 12.0 | Programming Language |
| Entity Framework Core | 8.0.7 | ORM (Object-Relational Mapping) |
| MS SQL Server | 2019+ | Relational Database |
| ASP.NET Core Identity | 8.0.7 | Authentication & User Management |
- JWT (JSON Web Tokens) - Stateless authentication
- Autofac (8.0.0) - Advanced IoC container
- AutoMapper (13.0.1) - Object-to-object mapping
- Swagger/OpenAPI - API documentation
The project follows Clean Architecture principles with:
1. Repository Pattern
- Abstracts data access layer
- Centralized query logic
- Easier unit testing
2. CQRS (Command Query Responsibility Segregation)
- Separates read and write operations
- Commands for state changes, Queries for data retrieval
3. Service Layer Pattern
- Business logic encapsulation
- Keeps controllers thin
4. DTO Pattern
- API contract separation from domain models
- Enhanced security and versioning
5. Dependency Injection
- Loose coupling via Autofac
- Testable and maintainable code
EduVerseWebAPI/
β
βββ Controllers/ # API Endpoints
βββ Models/ # Domain Entities
βββ Data/ # Database Context
βββ Configurations/ # EF Core Fluent API
βββ Repositories/ # Data Access Layer
βββ Services/ # Business Logic Layer
βββ Mediators/ # CQRS Implementation
βββ DTO/ # Data Transfer Objects
βββ ViewModels/ # API Response Models
βββ Middlewares/ # Custom Middleware
βββ Helpers/ # Utility Classes
βββ Profiles/ # AutoMapper Profiles
βββ Enums/ # Enumeration Types
βββ Exceptions/ # Custom Exceptions
βββ Migrations/ # EF Core Migrations
βββ AutoFacModule.cs # DI Configuration
βββ Program.cs # Entry Point
- Visual Studio 2022 (latest version) or VS Code
- .NET 8 SDK - Download
- SQL Server 2019+ - Download
- SSMS - Optional but recommended
git clone https://github.com/yourusername/EduVerseWebAPI.git
cd EduVerseWebAPIUpdate the connection string in appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=YOUR_SERVER_NAME;Database=EduVerseDB;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=true"
}
}Alternative with SQL Authentication:
{
"ConnectionStrings": {
"DefaultConnection": "Server=YOUR_SERVER;Database=EduVerseDB;User ID=YOUR_USERNAME;Password=YOUR_PASSWORD;TrustServerCertificate=True"
}
}Update JWT settings in appsettings.json:
{
"JWT": {
"ValidIssuer": "https://localhost:7001",
"ValidAudiance": "https://localhost:4200",
"Key": "YOUR_SECRET_KEY_MUST_BE_AT_LEAST_32_CHARACTERS_LONG",
"DurationInMinutes": 60
}
}Generate a secure key at: https://8gwifi.org/jwsgen.jsp
dotnet restoreOr manually via Package Manager Console:
Install-Package Microsoft.EntityFrameworkCore -Version 8.0.7
Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 8.0.7
Install-Package Microsoft.EntityFrameworkCore.Tools -Version 8.0.7
Install-Package Microsoft.AspNetCore.Identity.EntityFrameworkCore -Version 8.0.7
Install-Package Microsoft.AspNetCore.Authentication.JwtBearer -Version 8.0.7
Install-Package AutoMapper.Extensions.Microsoft.DependencyInjection -Version 13.0.1
Install-Package Autofac -Version 8.0.0
Install-Package Autofac.Extensions.DependencyInjection -Version 9.0.0
Install-Package Swashbuckle.AspNetCore -Version 6.6.2dotnet ef database updateUsing Package Manager Console:
Update-Databasedotnet runOr press F5 in Visual Studio
The API will be available at https://localhost:7xxx (check console for exact port)
Swagger UI: https://localhost:PORT/swagger
1. Register:
POST /Account/Register
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"password": "SecurePassword123!",
"confirmPassword": "SecurePassword123!",
"role": "Student"
}2. Login:
POST /Account/Login
Content-Type: application/json
{
"email": "john.doe@example.com",
"password": "SecurePassword123!"
}3. Use Token:
GET /Course/GetAll
Authorization: Bearer YOUR_JWT_TOKEN| Endpoint | Method | Description | Auth |
|---|---|---|---|
/Account/Register |
POST | Register user | β |
/Account/Login |
POST | User login | β |
/Course/GetAll |
GET | Get courses | β |
/Course/Create |
POST | Create course | β Instructor |
/Exam/Create |
POST | Create exam | β Instructor |
/Exam/TakeExam/{id} |
GET | Start exam | β Student |
/Exam/SubmitExam |
POST | Submit answers | β Student |
- Users (Student, Instructor) - TPH inheritance
- Courses - Course information
- Exams - Exam details and timing
- Questions - Question bank (MCQ, TrueFalse, Essay)
- Choices - Multiple choice options
- ExamQuestions - Exam-Question relationship
- ExamStudents - Student enrollments
- ExamAnswers - Student submissions
- Assignments - Assignment details
- AssignmentSubmissions - Student submissions
- CourseStudents - Course enrollments
- TimelineItems - Course posts
- Comments - Post comments
- CourseReviews - Student ratings
β
View enrolled courses
β
Take exams
β
Submit assignments
β
View results
β
Post reviews
β
Create courses & exams
β
Grade subjective answers
β
View all results
β
Manage timeline
- JWT Authentication with refresh tokens
- Role-based Authorization
- Password Hashing (ASP.NET Identity)
- SQL Injection Prevention (EF Core)
- HTTPS Enforcement
- Soft Delete pattern
Project Link: https://github.com/yourusername/EduVerseWebAPI
Built with β€οΈ using ASP.NET Core 8
β Star this repo if you find it helpful!