CarSales is a web-based car listing and management system built with ASP.NET Core MVC and MySQL. It supports user registration, login, admin car management, and secure role-based access. Authentication is managed via ASP.NET Identity, with session tracking through cookies.
- User registration and login (with Identity)
- Admin panel to manage cars and users
- View car listings and detailed car info
- Rate-limited API endpoints for protection
- Role-based access control
- Cookie-based authentication
- ASP.NET Core MVC
- Entity Framework Core (MySQL)
- ASP.NET Identity
- MySQL
- Swagger (OpenAPI spec included)
- .NET SDK 8.0+
- MySQL Server 8+
- Visual Studio or VS Code
git clone https://github.com/KristiyanDinev/CarSales.git
cd CarSalesUpdate the appsettings.json with your MySQL credentials:
{
"ConnectionString": "server=127.0.0.1;uid=root;pwd=root;database=CarsDB"
}Make sure the database
CarsDBexists. You can create it using:
CREATE DATABASE CarsDB;If using EF Core Migrations:
dotnet ef migrations add InitialCreate
dotnet ef database updatedotnet runNavigate to https://localhost:5001 (or the port printed in the console).
The app uses cookie-based authentication. On login, a cookie is created with the name Authentication.
-
Default admin user:
- Email: admin@example.com
- Password: Admin123!
-
Automatically created on first run with
Adminrole.
The application includes a Swagger-compatible OpenAPI JSON file defining all endpoints. You can use this for client generation, testing, or documentation.
After logging in as admin, you can:
- View, create, edit, and delete car listings
- Assign/remove admin roles from other users
- Test rate limiting by calling endpoints rapidly (1 request/sec limit)
- Try logging in with invalid credentials to validate error handling
For issues or contributions, feel free to open an issue or pull request.