SahibindenAl is a web application. It allows users to post listings in various categories (e.g., real estate, vehicles), search for listings with filters, and view their details. The project was developed using modern .NET technologies following the MVC (Model-View-Controller) architecture.
- User Management: Registration and login functionalities.
- Ad Creation: Allows users to post listings in different categories with dynamic properties (e.g., "Model Year," "Mileage" for a car).
- Ad Viewing: Detailed pages for listings, including information and images.
- Advanced Search and Filtering: Search for ads on the homepage by category, city, district, and price.
- Dynamic Forms: Ad posting forms that change based on the selected category.
- Database Management: Code-first database management and migrations with Entity Framework Core.
- Repository Pattern: Abstraction of the data access layer to increase manageability.
- Backend: C#, ASP.NET Core MVC (.NET 9)
- Database: PostgreSQL
- ORM: Entity Framework Core
- User Management: ASP.NET Core Identity
- Frontend: HTML, CSS, JavaScript, Bootstrap
- Other Libraries:
Npgsql.EntityFrameworkCore.PostgreSQL: PostgreSQL database provider.- Library Manager (LibMan): For client-side library management.
The main directories and files of the project are explained below:
SahibindenAl/
├── Controllers/ # Controllers that handle incoming requests and return responses.
│ ├── AccountController.cs # User login/registration operations.
│ ├── AdvertController.cs # Ad creation and viewing operations.
│ ├── DetailedSearchController.cs # Advanced filtering and detailed search operations.
| └── HomeController.cs # Homepage and ad listing/filtering.
├── Data/ # Database context and migrations.
│ └── AppDbContext.cs
├── DTOs/ # Data Transfer Objects.
├── Models/ # Classes representing database entities.
├── Views/ # Razor (.cshtml) files that create the user interface.
├── Repository/ # Data access layer (Repository Pattern).
├── Service/ # Business logic layer.
├── wwwroot/ # Static files (CSS, JS, images).
├── appsettings.json # Application configuration settings (e.g., database connection string).
├── libman.json # Client-side library definitions for LibMan.
└── Program.cs # The application's entry point and service configuration.
Follow the steps below to run the project on your local machine:
-
Clone the Project:
git clone https://github.com/kilic-mustafa/SahibindenAl.git cd SahibindenAl -
Configure the Database Connection: Open the
SahibindenAl/appsettings.jsonfile and update theDefaultConnectionfield with your PostgreSQL connection details."ConnectionStrings": { "DefaultConnection": "Host=localhost;Database=sahibindenal_db;Username=postgres;Password=your_password" }
-
Install .NET Dependencies: Open a terminal in the project root directory (where the .sln file is) and run the command:
dotnet restore
-
Restore Client-Side Libraries (LibMan): This project uses LibMan to manage static assets. To restore them:
# Install LibMan CLI if you haven't already dotnet tool install -g Microsoft.Web.LibraryManager.Cli # Restore libraries cd SahibindenAl libman restore
-
Create the Database (Migrations): Navigate to the
SahibindenAlproject folder and apply the Entity Framework Core migrations to create the database.cd SahibindenAl dotnet ef database update
To start the project, run the following command in the SahibindenAl folder:
dotnet runThe application will start running on https://localhost:7209 and http://localhost:5209 by default. You can start using the application by navigating to one of these addresses in your browser.
- Post a New Ad: Create an account using the "Login" or "Register" links in the top right corner. After logging in, you can create your new ad with the "Post Ad" button.
- Search for Ads: You can search among existing ads using the filtering options (category, city, district, etc.) on the homepage.
Your contributions will make the project better! If you want to contribute:
- Fork the project.
- Create your own branch for a new feature or fix (
git checkout -b feature/new-feature). - Commit your changes (
git commit -m 'Added new feature'). - Push your branch to the main repository (
git push origin feature/new-feature). - Open a Pull Request (PR).
This project is licensed under the MIT License. See the LICENSE file for details.