Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dokumentasi

Technology Stack

  • .NET 8 - ASP.NET Core MVC
  • Entity Framework Core 8 - ORM
  • SQL Server - Database
  • jQuery + AJAX - Frontend interactions
  • DataTables - Interactive tables
  • HTML5 + CSS3 - Custom CSS (NO Bootstrap)

Prerequisites

  • .NET 8 SDK
  • SQL Server (LocalDB, Docker, or full SQL Server instance)
  • Docker (optional, for SQL Server on macOS/Linux)

Quick Setup

1. Database Connection

Update RentCar.Web/appsettings.json:

Docker (macOS/Linux):

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost,1433;Database=RentCarDb;User Id=sa;Password=YourStrong@Passw0rd;TrustServerCertificate=true;MultipleActiveResultSets=true"
  }
}

LocalDB (Windows):

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=RentCarDb;Trusted_Connection=true;MultipleActiveResultSets=true"
  }
}

2. Create Database

cd RentCar.Web
dotnet ef database update

3. Run Application

dotnet run

Access at http://localhost:5000 or https://localhost:5001

Docker Setup (macOS/Linux)

# Start SQL Server
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=YourStrong@Passw0rd" -e "MSSQL_PID=Developer" -p 1433:1433 --name rentcar-sqlserver -d mcr.microsoft.com/mssql/server:2022-latest

# Start/Stop container
docker start rentcar-sqlserver
docker stop rentcar-sqlserver

Adding Sample Data

-- Insert car (Status = 1 is required!)
INSERT INTO MsCar (Car_id, Name, Model, Year, license_plate, number_of_car_seats, Transmission, price_per_day, Status)
VALUES (NEWID(), 'Toyota Avanza', 'Avanza', 2023, 'B1234XYZ', 7, 'Manual', 550000, 1);

-- Add car image
DECLARE @CarId NVARCHAR(36) = (SELECT Car_id FROM MsCar WHERE Name = 'Toyota Avanza');
INSERT INTO MsCarImages (Image_car_id, image_link, FK_Car_id)
VALUES (NEWID(), 'https://via.placeholder.com/800x400?text=Car', @CarId);

Important: Cars must have Status = 1 to appear in search results.

Key Features

  • ✅ Cookie-based authentication (Login/Register)
  • ✅ AJAX-based car search with date filtering
  • ✅ Car availability checking (no overlapping rentals)
  • ✅ Rental history with DataTables (sort, search, pagination)
  • ✅ Custom CSS sidebar navigation (NO Bootstrap)
  • ✅ LINQ queries for all database operations
  • ✅ Service layer architecture

Project Structure

RentCar.Web/
├── Controllers/     # AuthController, HomeController, RentalController, ApiController
├── Models/          # 7 entities (MsCustomer, MsCar, TrRental, etc.)
├── ViewModels/     # View models for forms
├── Services/        # Business logic (AuthService, CarService, RentalService)
├── Data/            # DbContext + Migrations
├── Views/           # Razor views (Home, Auth, Rental)
└── wwwroot/         # CSS, JS, static assets

API Endpoints

  • GET /api/cars/available?pickupDate={date}&returnDate={date}&year={year} - Get available cars
  • GET /api/rentals/history - Get user's rental history (requires auth)

Troubleshooting

Cars not appearing:

  • Verify Status = 1 in database
  • Check for active rentals overlapping search period
  • Must click "Cari" button after filling date form

Database connection:

  • Ensure SQL Server is running
  • Check connection string in appsettings.json
  • Wait a few seconds after starting Docker container

Build errors:

  • Run dotnet restore
  • Verify .NET 8 SDK: dotnet --version

Database Schema

7 entities: MsCustomer, MsCar, TrRental, LtPayment, MsCarImages, MsEmployee, TrMaintenance

About

ITDIV Final Submission that Led to an Interview

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages