Skip to content

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EduVerse Examination System API

.NET C# SQL Server JWT

A comprehensive RESTful API for online examination and course management system built with ASP.NET Core 8

Features β€’ Tech Stack β€’ Getting Started β€’ API Documentation


πŸ“‹ Overview

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.

Key Capabilities

  • 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

πŸ› οΈ Tech Stack

Core Technologies

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

Key Libraries

  • 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

πŸ—οΈ Architecture & Design Patterns

The project follows Clean Architecture principles with:

Design Patterns Used

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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • Visual Studio 2022 (latest version) or VS Code
  • .NET 8 SDK - Download
  • SQL Server 2019+ - Download
  • SSMS - Optional but recommended

Installation Steps

1. Clone the Repository

git clone https://github.com/yourusername/EduVerseWebAPI.git
cd EduVerseWebAPI

2. Configure Database Connection

Update 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"
  }
}

3. Configure JWT Authentication

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

4. Install NuGet Packages

dotnet restore

Or 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.2

5. Apply Database Migrations

dotnet ef database update

Using Package Manager Console:

Update-Database

6. Run the Application

dotnet run

Or press F5 in Visual Studio

The API will be available at https://localhost:7xxx (check console for exact port)


πŸ“š API Documentation

Swagger UI: https://localhost:PORT/swagger

Authentication Flow

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

Main Endpoints

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

πŸ—„οΈ Database Schema

Main Entities

  • 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

πŸ‘₯ User Roles

Student

βœ… View enrolled courses
βœ… Take exams
βœ… Submit assignments
βœ… View results
βœ… Post reviews

Instructor

βœ… Create courses & exams
βœ… Grade subjective answers
βœ… View all results
βœ… Manage timeline


πŸ” Security Features

  • JWT Authentication with refresh tokens
  • Role-based Authorization
  • Password Hashing (ASP.NET Identity)
  • SQL Injection Prevention (EF Core)
  • HTTPS Enforcement
  • Soft Delete pattern

πŸ“§ Contact

Project Link: [https://github.com/MinaMagdy484/EduVerseWebAPI](https://github.com/MinaMagdy484/EduVerseWebAPI)


Built with ❀️ using ASP.NET Core 8

⭐ Star this repo if you find it helpful!

About

A comprehensive RESTful API for online examination and course management system built with ASP.NET Core 8, Entity Framework Core, and SQL Server

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages