A robust RESTful API for managing event bookings, built with .NET 8.0. This system handles event listings, reservations, and ticket management with real-time seat availability tracking.
- Features
- Technical Stack
- Getting Started
- API Documentation
- Project Structure
- Testing
- Future Enhancements
- Event Management: List and manage available events
- Reservation System: Handle event reservations with automatic timeout
- Seat Availability: Real-time tracking of available seats
- Ticket Booking: Book and confirm tickets for events
- User Reservations: Manage user-specific reservations
- RESTful Design: Follows REST API best practices
- Backend: .NET 8.0
- Architecture: REST API
- Data Storage: In-memory (with mock repository)
- Documentation: Swagger/OpenAPI
- Development Tools: Visual Studio Code, Postman
- .NET 8.0 SDK
- Visual Studio Code or any .NET IDE
- Postman (for API testing)
- Clone the repository
git clone https://github.com/ebra8/EventBookingAPI- Navigate to the project directory
cd EventBookingAPI- Restore dependencies
dotnet restore- Build the project
dotnet build- Run the application
dotnet runThe API will be available at:
- HTTP: http://localhost:5261
- HTTPS: https://localhost:7261
http://localhost:5261/api/eventbooking
GET /eventsReturns a list of all available events.
Response
[
{
"id": "evt-001",
"name": "Tech Conference 2025",
"description": "Annual technology conference...",
"eventDate": "2025-06-26T01:31:03.123Z",
"location": "San Francisco Convention Center",
"ticketPrice": 299.99,
"availableSeats": 500
}
]GET /reservations/{userId}Returns the current reservation for a specific user.
Response
{
"userId": "user123",
"createdAt": "2024-04-26T01:31:03.123Z",
"expiresAt": "2024-04-26T01:46:03.123Z",
"items": [
{
"eventId": "evt-001",
"eventName": "Tech Conference 2025",
"eventDate": "2025-06-26T01:31:03.123Z",
"location": "San Francisco Convention Center",
"ticketCount": 2,
"price": 299.99
}
],
"totalPrice": 599.98,
"totalTickets": 2
}POST /reservations/{userId}/eventsAdds an event to the user's reservation.
Request Body
{
"eventId": "evt-001",
"ticketCount": 2
}DELETE /reservations/{userId}/events/{eventId}Removes an event from the user's reservation.
POST /reservations/{userId}/confirmConfirms the user's reservation and generates tickets.
Response
{
"bookingId": "guid",
"userId": "user123",
"bookedEvents": [...],
"totalAmount": 599.98,
"bookingDate": "2024-04-26T01:31:03.123Z",
"confirmationCode": "BK-20240426-ABC123",
"ticketCodes": ["TIX-001-ABC123", "TIX-001-DEF456"]
}EventBookingAPI/
├── Controllers/
│ └── EventBookingController.cs # API endpoints
├── Models/
│ └── EventModels.cs # Data models
├── Services/
│ └── BookingService.cs # Business logic
├── Data/
│ ├── IEventRepository.cs # Repository interface
│ └── MockEventRepository.cs # Mock implementation
└── Program.cs # Application setup
The API can be tested using Postman or any HTTP client. A test file EventBookingAPI.http is included in the project for easy testing.
- Authentication and Authorization
- Database Integration
- Payment Processing
- Email Notifications
- Frontend Application
- Real-time Updates
- Analytics Dashboard