A comprehensive parking management solution built with ASP.NET Core, featuring NFC payments, role-based access control, and automated CI/CD pipelines.
- .NET 8.0 SDK - Download here
- SQLite (comes with .NET)
- Git for version control
# 1. Clone the repository
git clone <repository-url>
cd Software_Construction
# 2. Build and run the API
cd "CSharp Parking API"
dotnet restore
dotnet run
# 3. Run tests (optional)
cd "../CSharp Parking Tests"
dotnet testThe API will start on http://localhost:5000 (or configured port).
Software_Construction/
├── CSharp Parking API/ # Main ASP.NET Core API
│ ├── Controllers/ # REST API endpoints
│ ├── Services/ # Business logic layer
│ ├── Models/ # Data models & DTOs
│ ├── Database/ # SQLite database setup
│ └── Migrations/ # EF Core migrations
├── CSharp Parking Tests/ # Comprehensive test suite
│ ├── API Tests/ # Integration tests
│ └── Services/ # Unit tests
├── Python Parking API/ # Legacy Python implementation
├── Test/ # Integration tests
├── .github/workflows/ # CI/CD pipelines
└── docs/ # Technical documentation
# Restore dependencies
dotnet restore
# Build in debug mode
dotnet build
# Run API locally
dotnet run
# Run with hot reload (development)
dotnet watch run# Add new migration
dotnet ef migrations add "MigrationName"
# Update database
dotnet ef database update
# Generate SQL script
dotnet ef migrations script# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run specific test class
dotnet test --filter "TestClassName"
# Run tests in watch mode
dotnet watch test# Format code
dotnet format
# Run static analysis
dotnet build /p:RunAnalyzersDuringBuild=trueThe system uses JWT-based authentication with 3 user roles:
- ParkingUser: Regular users (book parking, view reservations)
- ParkingLotAdmin: Location managers (manage specific parking lot)
- SuperAdmin: System administrators (full access)
# Get auth token (replace with actual credentials)
curl -X POST http://localhost:5000/api/v2/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"youruser","password":"yourpass"}'Test Types:
- API Tests: End-to-end testing via HTTP client
- Service Tests: Unit tests for business logic
- Integration Tests: Full workflow testing
cd "CSharp Parking Tests"
dotnet test --verbosity normal --logger "trx;LogFileName=test-results.trx"# Generate coverage report
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator "-reports:test-results/**/*.xml" "-targetdir:coveragereport"Triggers: Push to any branch
- Staging: Automatic deployment for feature branches
- Production: Manual deployment for
masterbranch only
# Build for production
dotnet publish -c Release -o ./publish
# Create deployment package
tar -czf api-package.tar.gz -C ./publish .
# Deploy (configure your target environment)
# Azure App Service, Docker, AWS, etc.# Database
ConnectionStrings__DefaultConnection="Data Source=parking.db"
# JWT Configuration
Jwt__Key="your-secret-key-here"
Jwt__Issuer="parking-api"
Jwt__Audience="parking-users"
# Server Configuration
ASPNETCORE_URLS="http://+:5000"
ASPNETCORE_ENVIRONMENT="Production"- Contactless parking payments
- Hotel discount integration (20% off for hotel guests)
- Balance verification before payment
- Automatic session creation
- Guest registration system
- Automatic discount application
- Check-in/check-out management
- Real-time performance monitoring
- Test execution timing reports
- Coverage metrics tracking
- JWT token authentication
- Role-based access control (RBAC)
- Token revocation (logout)
- Secure password hashing
Port already in use:
# Find process using port 5000
netstat -ano | findstr :5000
# Kill the process
taskkill /PID <PID> /FDatabase connection errors:
# Ensure database exists
dotnet ef database update
# Check connection string in appsettings.jsonTest failures:
# Clean and rebuild tests
dotnet clean
dotnet restore
dotnet build
dotnet test --no-build# Run with detailed logging
dotnet run --environment Development --verbose- Technical Documentation: See detailed docs in project folders
- API Endpoints: Swagger UI at
/swaggerwhen running locally - Database Schema:
database_schema.sql - Test Coverage:
TESTS_CICD.md
- Create feature branch:
git checkout -b feature/your-feature - Make changes and write tests
- Run tests:
dotnet test - Commit:
git commit -m "feat: your feature description" - Push:
git push origin feature/your-feature - Create PR to trigger CI/CD
- Follow C# naming conventions
- Write comprehensive unit tests
- Maintain 80%+ code coverage
- Use meaningful commit messages
- ✅ All tests pass
- ✅ Code coverage maintained
- ✅ Security scan passes
- ✅ Code review approved
For questions or issues:
- Check existing documentation
- Review CI/CD logs for errors
- Create an issue with detailed reproduction steps
Built with ❤️ using ASP.NET Core 8.0, SQLite, and modern DevOps practices