A comprehensive Event Booking System built with .NET 9.0 following Clean Architecture principles.
This project follows Clean Architecture with the following layers:
- Domain Layer (
EventBooking.Domain): Contains core business entities (Event, User, Booking) - Application Layer (
EventBooking.Application): Contains business logic, DTOs, interfaces, and services - Infrastructure Layer (
EventBooking.Infrastructure): Contains data access implementation with Entity Framework Core - API Layer (
EventBooking.Api): Contains RESTful API controllers and configuration
- Event Management (Create, Read, Update, Delete)
- User Management (Create, Read, Update, Delete)
- Booking Management (Create bookings, Cancel bookings)
- Automatic seat availability tracking
- Duplicate booking prevention
- Pagination support for upcoming events
- .NET 9.0
- ASP.NET Core Web API
- Entity Framework Core 9.0
- SQL Server LocalDB
- Swagger/Swashbuckle
- .NET 9.0 SDK
- SQL Server LocalDB or SQL Server
git clone <repository-url>
cd EventBookingEdit src/EventBooking.Api/appsettings.json if you need a different connection string:
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=EventBookingDb;Trusted_Connection=true;TrustServerCertificate=true;"
}dotnet ef database update --project EventBooking.Infrastructure --startup-project src/EventBooking.Apidotnet buildcd src/EventBooking.Api
dotnet runThe API will be available at:
- HTTPS:
https://localhost:5001 - HTTP:
http://localhost:5000 - Swagger UI:
https://localhost:5001/swagger(in Development mode)
GET /api/events- Get all eventsGET /api/events/upcoming?page=1&pageSize=10- Get upcoming events with paginationGET /api/events/{id}- Get event by IDPOST /api/events- Create new eventPUT /api/events/{id}- Update eventDELETE /api/events/{id}- Delete event
GET /api/users- Get all usersGET /api/users/{id}- Get user by IDGET /api/users/email/{email}- Get user by emailPOST /api/users- Create new userPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete user
GET /api/bookings/{id}- Get booking by IDGET /api/bookings/user/{userId}- Get all bookings for a userGET /api/bookings/event/{eventId}- Get all bookings for an eventPOST /api/bookings- Create new bookingDELETE /api/bookings/{id}- Cancel booking
POST /api/events
{
"title": "Tech Conference 2026",
"description": "Annual technology conference",
"date": "2026-06-15T09:00:00",
"location": "Convention Center",
"capacity": 500
}POST /api/users
{
"email": "user@example.com",
"name": "John Doe"
}POST /api/bookings
{
"eventId": 1,
"userId": 1
}EventBooking/
├── EventBooking.Domain/
│ └── Entities/
│ ├── Event.cs
│ ├── User.cs
│ └── Booking.cs
├── EventBooking.Application/
│ ├── DTOs/
│ ├── Interfaces/
│ ├── Services/
│ └── DependencyInjection.cs
├── EventBooking.Infrastructure/
│ ├── Persistance/
│ │ ├── AppDbContext.cs
│ │ ├── Repositories/
│ │ └── Migrations/
│ └── DependencyInjection.cs
└── src/
└── EventBooking.Api/
├── Controllers/
├── Program.cs
└── appsettings.json
- Id (PK)
- Title
- Description
- Date
- Location
- Capacity
- AvailableSeats
- CreatedAt
- UpdatedAt
- Id (PK)
- Email (Unique)
- Name
- CreatedAt
- Id (PK)
- EventId (FK)
- UserId (FK)
- CreatedAt
- Status
- Unique constraint on (EventId, UserId)
- Users cannot book the same event twice
- Events cannot be overbooked (available seats must be > 0)
- When a booking is created, available seats decrease by 1
- When a booking is cancelled, available seats increase by 1
- Email addresses must be unique for users
dotnet ef migrations add <MigrationName> --project EventBooking.Infrastructure --startup-project src/EventBooking.Apidotnet ef migrations remove --project EventBooking.Infrastructure --startup-project src/EventBooking.Apidotnet ef database update --project EventBooking.Infrastructure --startup-project src/EventBooking.ApiThis project is licensed under the MIT License.