A simple flight management solution built with ASP.NET Core Web API on the backend and a .NET console client on the front end. The API exposes full CRUD operations for flights, backed by SQL Server stored procedures, and the console client consumes those endpoints over HTTP.
Flight Booking System/
├── Flight Booking System/ # ASP.NET Core 8 Web API
│ ├── Controllers/
│ │ └── FlightController.cs # REST endpoints for flight CRUD operations
│ ├── Data/
│ │ └── DBConnectionFactory.cs # Creates SqlConnection instances from config
│ ├── Models/
│ │ └── Flight.cs # Flight entity
│ ├── Repository/
│ │ ├── IFlightRepository.cs
│ │ └── FlightRepository.cs # ADO.NET data access (calls stored procedures)
│ ├── Services/
│ │ ├── IFlightServices.cs
│ │ └── FlightServices.cs # Business logic layer
│ ├── menus/
│ │ └── menu.cs # Console-based menu for direct repository access
│ ├── appsettings.json # Configuration (connection string, logging)
│ └── Program.cs # App startup / DI configuration
│
├── FlightBookingClient/ # .NET Framework console client
│ ├── MenuHandler/
│ │ └── Menu.cs # Interactive console menu
│ ├── Model/
│ │ └── Flight.cs # Client-side Flight DTO
│ ├── Services/
│ │ └── FlightServices.cs # HttpClient wrapper for calling the API
│ └── Program.cs # Entry point
│
├── SQLScripts/
│ └── FlightDB.sql # Database, table, and stored procedure definitions
│
└── Flight Booking System.slnx # Visual Studio solution file
- View all flights — retrieve every active flight, ordered by departure time
- Search by Flight ID — fetch a single flight's details
- Add a flight — insert a new flight with validation (non-empty fields, distinct source/destination, future departure time, positive price, non-negative seats)
- Update a flight — modify an existing flight's details
- Delete a flight — soft-delete (flight is deactivated, not physically removed, preserving data for audit)
- Duplicate prevention — flight numbers must be unique among active flights
- Console client — a standalone menu-driven client that talks to the API over HTTP
| Layer | Technology |
|---|---|
| API | ASP.NET Core 8 (Minimal hosting model) |
| Data access | ADO.NET (Microsoft.Data.SqlClient) + stored procedures |
| Database | SQL Server |
| API documentation | Swagger / Swashbuckle |
| Client | .NET Framework 4.7.2 console app (HttpClient) |
- .NET 8 SDK
- .NET Framework 4.7.2 Developer Pack (for the console client)
- SQL Server (LocalDB, Express, or a full instance)
- Visual Studio 2022 (recommended) or any editor that supports
.slnxsolutions
git clone https://github.com/mohanish-kv/Flight-Booking-System.git
cd Flight-Booking-SystemRun the script in SQLScripts/FlightDB.sql against your SQL Server instance. It will:
- Create the
FlightDBdatabase - Create the
Flightstable - Seed a handful of sample flights
- Create the stored procedures used by the API:
sp_GetAllFlightssp_GetFlightByIdsp_InsertFlightsp_UpdateFlightsp_DeleteFlight(soft delete)sp_SearchFlights(filter by source city, destination city, and/or travel date)
sqlcmd -S <your_server> -i SQLScripts/FlightDB.sqlUpdate Flight Booking System/appsettings.json (and appsettings.Development.json) with your SQL Server instance name:
{
"ConnectionStrings": {
"DefaultConnection": "Server=YOUR_SERVER;Database=FlightDB;Trusted_Connection=True;TrustServerCertificate=True"
}
}
⚠️ These files currently contain a hardcoded server name for local development. Update them (or better, move secrets todotnet user-secrets/ environment variables) before deploying.
cd "Flight Booking System"
dotnet runThe API starts on http://localhost:5251 by default, and the Swagger UI opens automatically at /swagger for exploring and testing the endpoints.
The client targets .NET Framework and is set up to be run from Visual Studio, or via msbuild + the compiled executable:
cd FlightBookingClient
# Build with Visual Studio or msbuild, then run the resulting FlightBookingClient.exeBy default the client points at http://localhost:5251/, so make sure the API is running first.
Because the controller uses action-based routing (api/[controller]/[action]), each endpoint includes the action name:
| Method | Route | Description |
|---|---|---|
| GET | /api/Flight/GetAllDetails |
Get all active flights |
| GET | /api/Flight/GetFlightById/{FlightID} |
Get a single flight by ID |
| POST | /api/Flight/Post |
Add a new flight (query params) |
| PUT | /api/Flight/Put |
Update an existing flight (JSON body) |
| DELETE | /api/Flight/DeleteFlight |
Delete a flight (FlightId query param) |
Note: The bundled console client currently calls routes like
api/flight/{id}(attribute-style), which don't match the API's action-based routes above. If you're wiring the client up against the API, update the client'sFlightServices.csto use the correct action names, or switch the controller to attribute routing.
- Connection strings in
appsettings.jsonare checked into source control — replace with environment-specific configuration before any real deployment. - The console client's request URLs don't fully match the API's route names (see above).
- There's a stray top-level
Flight.csand an emptyFlightBookingClient/models/Flight.csleft over from earlier iterations; safe to remove once confirmed unused. sp_SearchFlightsis defined in the database but not yet wired up to a controller endpoint.
No license has been specified for this project yet. Add a LICENSE file if you intend to open-source it.