- Overview
- Architecture
- Backend Documentation
- Frontend Documentation
- Database Schema
- API Endpoints
- User Roles & Permissions
- Setup & Installation
- Features
- Security
StudyValyria is a comprehensive digital learning platform built with ASP.NET Web API backend and vanilla JavaScript frontend. The platform supports three user types: Students, Educators, and Administrators, each with role-specific dashboards and functionality.
- User authentication and authorization
- Course management and enrollment
- Interactive quizzes and assessments
- Progress tracking and analytics
- Activity logging and monitoring
- Contact form and messaging
- Responsive web design
- Backend: ASP.NET Web API (.NET Framework 4.8.1)
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Database: SQL Server
- Authentication: Custom JWT-like session management
- Styling: Custom CSS with responsive design
WAPPAssignment/
├── Controllers/ # Web API Controllers
├── App_Start/ # Application configuration
├── Views/ # Frontend files (HTML, CSS, JS)
├── Properties/ # Assembly information
├── DatabaseSetup.sql # Database schema and sample data
├── Web.config # Application configuration
└── Global.asax # Application lifecycle events
The backend follows RESTful API principles with the following controllers:
Purpose: Handles user authentication
POST /api/auth/login- User login with email/password validation- Returns user data on successful authentication
- Validates credentials against database
Purpose: User management operations
GET /api/users- Retrieve all users (admin only)GET /api/users/{id}- Get specific user detailsPOST /api/users- Create new user accountPUT /api/users/{id}- Update user profileDELETE /api/users/{id}- Delete user accountGET /api/users/check-email- Check email availabilityPUT /api/users/{id}/approve- Approve educator accountsPUT /api/users/{id}/status- Update user status
Purpose: Course management
GET /api/courses- List all coursesGET /api/courses/{id}- Get course detailsPOST /api/courses- Create new course (educators)PUT /api/courses/{id}- Update course informationDELETE /api/courses/{id}- Delete courseGET /api/courses/educator/{educatorId}- Get courses by educator
Purpose: Student course enrollments
GET /api/enrollments- Get all enrollmentsGET /api/enrollments/student/{studentId}- Student's enrollmentsGET /api/enrollments/course/{courseId}- Course enrollment listPOST /api/enrollments- Enroll student in courseDELETE /api/enrollments/{id}- Unenroll from course
Purpose: Quiz and assessment management
GET /api/quizzes/questions/{courseId}- Get quiz questions for courseGET /api/quizzes/results/user/{userId}- User's quiz resultsPOST /api/quizzes/results- Submit quiz results
Purpose: Activity tracking and analytics
GET /api/activity/user/{userId}- User-specific activitiesGET /api/activity/system- System-wide activitiesGET /api/activity/study-hours/{userId}- Calculate study hoursPOST /api/activity/log- Log custom activities
Purpose: Contact form submissions
POST /api/contact- Submit contact messages
The backend uses SQL Server with connection string configured in Web.config. All controllers use SqlConnection for database operations with proper error handling and resource disposal.
- Controllers implement try-catch blocks
- Returns appropriate HTTP status codes
- Provides meaningful error messages
- Logs errors for debugging
Views/
├── index.html # Landing page
├── login.html # Login page
├── register.html # Registration page
├── student-dashboard.html # Student interface
├── educator-dashboard.html # Educator interface
├── admin-dashboard.html # Admin interface
├── styles.css # Global styles
├── guest-script.js # Landing page functionality
├── login-script.js # Login functionality
├── register-script.js # Registration functionality
├── student-script.js # Student dashboard logic
├── educator-script.js # Educator dashboard logic
└── admin-script.js # Admin dashboard logic
- Course browsing for guests
- Contact form
- Navigation to login/register
- Responsive course grid display
Login (login.html)
- Email/password validation
- Demo account information
- Error handling and display
- Automatic redirection based on user role
Registration (register.html)
- Multi-step form validation
- Real-time email availability checking
- Password strength validation
- Role selection (Student/Educator)
Student Dashboard
- Overview with statistics (enrolled courses, quiz scores, study hours)
- Course enrollment and management
- Quiz taking interface with detailed results
- Profile management
- Progress tracking
Educator Dashboard
- Teaching overview (created courses, total students, revenue)
- Course creation and management
- Student enrollment monitoring
- Profile management with bio
- Course analytics
Admin Dashboard
- Platform overview (total users, courses, enrollments)
- User management (approve, activate, delete)
- Course oversight
- System analytics
- Platform settings
- Initialization: Each dashboard checks user authentication and role
- API Communication: Fetch API for all backend communication
- Error Handling: Try-catch blocks with user-friendly error messages
- Local Storage: Session management and temporary data storage
- Dynamic Content: DOM manipulation for real-time updates
Authentication Flow
// Check user session
currentUser = JSON.parse(localStorage.getItem("studyvalyria_current_user"))
// Validate user role
if (!currentUser || currentUser.userType !== "expected_role") {
window.location.href = "login.html"
}API Communication Pattern
try {
const response = await fetch(`http://localhost:51264/api/endpoint`)
if (!response.ok) throw new Error('API call failed')
const data = await response.json()
// Process data
} catch (error) {
console.error('Error:', error)
// Show user-friendly error
}CREATE TABLE Users (
UserId INT IDENTITY(1,1) PRIMARY KEY,
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
Email NVARCHAR(100) UNIQUE NOT NULL,
Password NVARCHAR(255) NOT NULL,
UserType NVARCHAR(20) NOT NULL,
Bio NVARCHAR(500),
RegistrationDate DATETIME DEFAULT GETDATE(),
IsActive BIT DEFAULT 1,
IsApproved BIT DEFAULT 0
)CREATE TABLE Courses (
CourseId INT IDENTITY(1,1) PRIMARY KEY,
Title NVARCHAR(100) NOT NULL,
Description NVARCHAR(500),
Duration NVARCHAR(50),
Level NVARCHAR(20),
Price DECIMAL(10,2),
EducatorId INT,
CreatedDate DATETIME DEFAULT GETDATE(),
FOREIGN KEY (EducatorId) REFERENCES Users(UserId)
)CREATE TABLE Enrollments (
EnrollmentId INT IDENTITY(1,1) PRIMARY KEY,
StudentId INT,
CourseId INT,
EnrollmentDate DATETIME DEFAULT GETDATE(),
Progress DECIMAL(5,2) DEFAULT 0,
FOREIGN KEY (StudentId) REFERENCES Users(UserId),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
)CREATE TABLE QuizResults (
ResultId INT IDENTITY(1,1) PRIMARY KEY,
StudentId INT,
CourseId INT,
Score INT,
Date DATETIME DEFAULT GETDATE(),
FOREIGN KEY (StudentId) REFERENCES Users(UserId),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
)CREATE TABLE QuizQuestions (
QuestionId INT IDENTITY(1,1) PRIMARY KEY,
CourseId INT,
Question NVARCHAR(500),
OptionA NVARCHAR(200),
OptionB NVARCHAR(200),
OptionC NVARCHAR(200),
OptionD NVARCHAR(200),
CorrectAnswer INT,
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
)CREATE TABLE Activities (
ActivityId INT IDENTITY(1,1) PRIMARY KEY,
UserId INT,
Type NVARCHAR(50),
Message NVARCHAR(500),
Date DATETIME DEFAULT GETDATE(),
FOREIGN KEY (UserId) REFERENCES Users(UserId)
)CREATE TABLE ActivityLogs (
ActivityLogId INT IDENTITY(1,1) PRIMARY KEY,
UserId INT,
Type NVARCHAR(50),
Message NVARCHAR(500),
Date DATETIME DEFAULT GETDATE(),
FOREIGN KEY (UserId) REFERENCES Users(UserId)
)CREATE TABLE ContactMessages (
MessageId INT IDENTITY(1,1) PRIMARY KEY,
Name NVARCHAR(100),
Email NVARCHAR(100),
Message NVARCHAR(1000),
SubmittedDate DATETIME DEFAULT GETDATE()
)POST /api/auth/login- User login
GET /api/users- List usersGET /api/users/{id}- Get userPOST /api/users- Create userPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete userGET /api/users/check-email?email={email}- Check emailPUT /api/users/{id}/approve- Approve userPUT /api/users/{id}/status- Update status
GET /api/courses- List coursesGET /api/courses/{id}- Get coursePOST /api/courses- Create coursePUT /api/courses/{id}- Update courseDELETE /api/courses/{id}- Delete courseGET /api/courses/educator/{educatorId}- Educator courses
GET /api/enrollments- List enrollmentsGET /api/enrollments/student/{studentId}- Student enrollmentsGET /api/enrollments/course/{courseId}- Course enrollmentsPOST /api/enrollments- Create enrollmentDELETE /api/enrollments/{id}- Delete enrollment
GET /api/quizzes/questions/{courseId}- Get questionsGET /api/quizzes/results/user/{userId}- Get resultsPOST /api/quizzes/results- Submit results
GET /api/activity/user/{userId}- User activitiesGET /api/activity/system- System activitiesGET /api/activity/study-hours/{userId}- Study hoursPOST /api/activity/log- Log activity
POST /api/contact- Submit message
- Browse and enroll in courses
- Take quizzes and view results
- Track learning progress
- Update profile information
- View personal dashboard
- Create and manage courses
- View enrolled students
- Monitor course performance
- Update teaching profile
- Access teaching analytics
- Manage all users and courses
- Approve educator accounts
- View system analytics
- Configure platform settings
- Monitor system activities
- Visual Studio 2019 or later
- SQL Server (LocalDB or full version)
- .NET Framework 4.8.1
- IIS Express (included with Visual Studio)
-
Clone Repository
git clone [repository-url] cd WAPPAssignment -
Database Setup
- Open SQL Server Management Studio
- Create new database named
StudyValyria - Execute
DatabaseSetup.sqlscript
-
Configure Connection String
- Open
Web.config - Update connection string to match your SQL Server instance
- Open
-
Build and Run
- Open solution in Visual Studio
- Build solution (Ctrl+Shift+B)
- Run with IIS Express (F5)
-
Access Application
- Navigate to
http://localhost:[port]/Views/index.html - Use demo accounts or register new users
- Navigate to
- Student: student@studyvalyria.com / password123
- Educator: educator@studyvalyria.com / password123
- Admin: admin@studyvalyria.com / password123
- Registration with email validation
- Role-based authentication
- Profile management
- Account approval workflow
- Course creation and editing
- Enrollment system
- Progress tracking
- Course analytics
- Multiple-choice quizzes
- Automatic scoring
- Result history
- Performance analytics
- Role-specific interfaces
- Real-time statistics
- Activity feeds
- Responsive design
- User engagement metrics
- Course performance data
- System activity monitoring
- Study time calculation
- User approval system
- Platform configuration
- Content moderation
- System monitoring
- Password-based authentication
- Session management via localStorage
- Role-based access control
- Input validation and sanitization
- SQL injection prevention
- XSS protection
- CSRF mitigation
- Secure password handling
- Parameterized queries
- Error handling without information disclosure
- Proper resource disposal
- Input validation on both client and server
When contributing to StudyValyria:
- Follow existing code patterns
- Add proper error handling
- Update documentation
- Test all user roles
- Ensure responsive design
This project is developed for educational purposes as part of the Web Application Programming assignment.