Tip
If you are working with Azure SQL and you can't connect to the server you can check if the database status is Paused. In that case you can resume with az sql db update --resource-group <group_name> --server <server_name> --name dbname --set status=Online
API for reservation and travel management, developed in .NET and deployed in Railway with SQL database deployed in Azure.
- .NET 8
- Entity Framework Core
- SQL Server
- Railway (API Cloud Deployment)
- Swagger for Documentation
- Azure (SQL Server Cloud Deployment)
These instructions will give you a give to install and run the project in your local machine.
This project has the following structure:
└── 📁TravelCompanyAPI
└── 📁TravelCompany.Application
└── 📁Contracts
└── BookingRequest.cs
└── 📁Helpers
└── EmaiSenderHelper.cs
└── 📁Interfaces
└── IBookingGuestRepository.cs
└── IBookingRepository.cs
└── IBookingRoomRepository.cs
└── IGenericRepository.cs
└── IGuestRepository.cs
└── IHotelRepository.cs
└── IRoomRepository.cs
└── 📁Services
└── BookingGuestService.cs
└── BookingRoomService.cs
└── BookingService.cs
└── GuestService.cs
└── HotelService.cs
└── RoomService.cs
└── 📁TravelCompany.Domain
└── 📁Entities
└── 📁DB
└── Booking.cs
└── BookingGuest.cs
└── BookingRoom.cs
└── Guest.cs
└── Hotel.cs
└── Room.cs
└── 📁Enum
└── Currency.cs
└── Gender.cs
└── IdentityType.cs
└── RoomType.cs
└── 📁TravelCompany.Infraestructure
└── 📁Persistence
└── CoreDBContext.cs
└── 📁Repository
└── BookingGuestRepository.cs
└── BookingRepository.cs
└── BookingRoomRepository.cs
└── GenericRepository.cs
└── GuestRepository.cs
└── HotelRepository.cs
└── RoomRepository.cs
└── 📁TravelCompanyAPI
└── appsettings.Development.json
└── appsettings.json
└── 📁Controllers
└── AdminController.cs
└── CustomerController.cs
└── 📁Extensions
└── AppExtensions.cs
└── Program.cs
└── 📁Properties
└── launchSettings.json
└── TravelCompanyAPI.csproj
└── TravelCompanyAPI.csproj.user
└── TravelCompanyAPI.http
└── .gitattributes
└── .gitignore
└── LICENSE.txt
└── README.md
└── TravelCompanyAPI.sln
The following software and tools are required for run this project locally:
- Clone the repository:
git clone https://github.com/jett220201/TravelCompany-API.git
cd TravelCompany-API- Set connection string:
{
"ConnectionStrings": {
"travelConnection": "Server={your_server};Initial Catalog={your_db_catalog};Persist Security Info=False;User ID={user};Password={password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
}
}- Restore NuGet packages:
dotnet restore- Run project:
dotnet run- Open Swagger in http://localhost:{port}/swagger
This project follows Clean Architecture principles, dividing the application into well-defined layers:
- Application 🛠️ → Contains the business logic, rules and use cases.
- Domain 📦 → Defines the entities and contracts of the application.
- Infrastructure 🏗️ → Manages data persistence, database access and external services.
- Presentation (API) 🌍 → Exposes drivers and endpoints for interaction with external clients.
This separation improves the modularity, maintainability and testability of the code, allowing changing technologies without affecting the core business. 🚀
The following diagram explain how the database is defined:

| Method | Endpoint | Controller | Description | Parameters | Expected Response |
|---|---|---|---|---|---|
GET |
/api/hotel/all |
AdminController |
Retrieves all hotels | None | List of hotels (JSON) |
POST |
/api/hotel/create |
AdminController |
Creates a new hotel | Hotel data (JSON) | Created hotel |
POST |
/api/hotel/edit |
AdminController |
Edits an existing hotel | Hotel data (JSON) | Updated hotel data |
POST |
/api/hotel/addRoom |
AdminController |
Adds a room to a hotel | Hotel & Room IDs (JSON) | Updated hotel data |
POST |
/api/hotel/enable |
AdminController |
Enables a hotel | Hotel ID | Updated hotel data |
POST |
/api/hotel/disable |
AdminController |
Disables a hotel | Hotel ID | Updated hotel data |
GET |
/api/booking/all |
AdminController |
Retrieves all bookings | None | List of bookings (JSON) |
GET |
/api/booking/{id} |
AdminController |
Retrieves a booking by ID | id: Booking ID |
Booking details (JSON) |
POST |
/api/booking/new |
CustomerController |
Creates a new booking | Booking data (JSON) | Confirmation message |
GET |
/api/room/all |
AdminController |
Retrieves all rooms | None | List of rooms (JSON) |
POST |
/api/room/create |
AdminController |
Creates a new room | Room data (JSON) | Created room |
POST |
/api/room/edit |
AdminController |
Edits an existing room | Room data (JSON) | Updated room data |
POST |
/api/room/enable |
AdminController |
Enables a room | Room ID | Updated room data |
POST |
/api/room/disable |
AdminController |
Disables a room | Room ID | Updated room data |
GET |
/api/search |
CustomerController |
Searches for hotels | Search query (JSON) | Matching hotels (JSON) |
This project has been deployed using Railway for the API and Azure to host the SQL database.
For the API deployment you need to create an account in Railway and then you can connect your GitHub repository using any othe way offered by Railway. This project has been deployed using GitHub installation:
- Connect your GitHub account
- Choose your repository
- Railway will deploy your project automatically
- After the deploy is done you need add a new variable for the database url:
DATABASE_URL = Server={your_server};Initial Catalog={your_db_catalog};Persist Security Info=False;User ID={user};Password={password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;- Deploy your changes.
For the SQL database you need to create an account in Azure and then you can create some free resources:
- Go to Create resource
- Look for database categorie
- Select Azure SQL and create
- Select SQL Database
- Fill the form with your account information (Save your User and Password for the API)
- In the form you will need to create a SQL Server resource if dont have any one
- Once you have create your SQL Database you need to change the firewall settings, clic on the firewall option on top
- Select public access and enable selected networks
- Below on Firewall Rules add a new one with IPv4 and use your local IP or the IP of your API.
- Save and wait for replication.
- Connect to the database and create the database and tables.
- Juan Esteban Torres Tamayo
This project is licensed under the MIT License - see the LICENSE.md file for details.