This is the REST API for the Maxi Market project, built on ASP.NET Core 10 Web API and using Entity Framework Core to interact with SQL Server.
The backend is developed following SOLID principles and a clean, layered architecture:
- Controllers (
Controllers/): HTTP entry points that handle REST requests and return structured responses. All controllers delegate logic to the service layer. - Services (
Services/): Business logic layer divided into interfaces and implementation classes (Interfaces/andImplementation/). It promotes decoupling through dependency injection. - Data Transfer Objects (
DTOs/): Classes representing the data contract exposed to the outside. They are divided intoReadDTO(reading),CreateDTO(creation), andUpdateDTO(editing) to prevent the leakage of sensitive or unnecessary properties (such as passwords). - Models (
Models/): Represent the physical tables of the SQL Server database. - Auto Mapping: AutoMapper is used to perform bidirectional conversions between entities and DTOs in an automated and transparent way.
- Runtime & Framework: .NET 10 (C#)
- Data Access: Entity Framework Core 10
- Database: Microsoft SQL Server
- Key Libraries: AutoMapper & AutoMapper.Extensions.Microsoft.DependencyInjection
| Controller | Method | Route | Description |
|---|---|---|---|
| Auth | POST | /api/auth/login |
Log in user and return simulated token |
| Brands | GET | /api/brands |
Retrieve all registered brands |
| Brands | GET | /api/brands/{id} |
Retrieve a brand by ID |
| Brands | POST | /api/brands |
Register a new brand |
| Brands | PUT | /api/brands/{id} |
Update an existing brand |
| Brands | DELETE | /api/brands/{id} |
Delete a brand from the database |
| Categories | GET | /api/categories |
Retrieve all categories |
| Categories | GET | /api/categories/{id} |
Retrieve a category by ID |
| Categories | POST | /api/categories |
Register a new category |
| Categories | PUT | /api/categories/{id} |
Update an existing category |
| Categories | DELETE | /api/categories/{id} |
Delete a category |
| Products | GET | /api/products |
Retrieve products with query filters |
| Products | GET | /api/products/{id} |
Retrieve details of a product by ID |
| Products | POST | /api/products |
Register a new product |
| Products | PUT | /api/products/{id} |
Update an existing product |
| Products | DELETE | /api/products/{id} |
Delete a product |
- .NET 10 SDK installed.
- Running instance of SQL Server (LocalDB or other).
- Open the appsettings.json file and update the connection string
DefaultConnectionif necessary:"ConnectionStrings": { "DefaultConnection": "Server=YOUR_SERVER;Database=ECommerceDb;Trusted_Connection=True;TrustServerCertificate=True;" }
- Restore NuGet packages and build the backend:
dotnet build
- Run the backend server:
Note: On the first run, the application will automatically create the database if it does not exist and seed initial test data for brands, categories, users, and products.
dotnet run