This document provides a summary of the available API endpoints and key files for the Online Art Gallery backend project.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/Auth/register |
Register a new user |
| POST | /api/Auth/login |
Login and get a JWT token |
| GET | /api/Auth/{id} |
Get user details |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/ArtWork |
Get all artworks |
| GET | /api/ArtWork/{id} |
Get artwork by ID |
| GET | /api/ArtWork/category/{categoryId} |
Get artworks by category |
| GET | /api/ArtWork/{id}/image |
Get image bytes for artwork by ID |
| POST | /api/ArtWork/batch |
Get artworks by IDs (in body) (Admin/Customer) |
| POST | /api/ArtWork |
Create new artwork (Admin/Customer) |
| PUT | /api/ArtWork/{id} |
Update artwork (Admin only) |
| POST | /api/ArtWork/process-database-images |
Process images stored in the database (Admin/Customer) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/Category |
Get all categories |
| GET | /api/Category/{id} |
Get category by ID |
| POST | /api/Category |
Create new category (Admin only) |
| PUT | /api/Category/{id} |
Update category (Admin only) |
| DELETE | /api/Category/{id} |
Delete category (Admin only) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/Order |
Get all orders (Admin sees all, users see only their own) |
| GET | /api/Order/{id} |
Get order by ID |
| POST | /api/Order |
Create new order |
| GET | /api/Order/invoice/{id} |
Get invoice for an order |
- User.cs - Represents user accounts
- Category.cs - Represents art categories
- ArtWork.cs - Represents art pieces
- Order.cs - Represents customer orders
- OrderItem.cs - Represents items in an order
- ArtGalleryContext.cs - Entity Framework
DbContextfor database operations - DataSeeder.cs - Seeds initial data into the database
- UserDtos.cs - DTOs for user-related operations
- ArtWorkDtos.cs - DTOs for artwork-related operations
- OrderDtos.cs - DTOs for order-related operations
- AuthController.cs - Handles user authentication and registration
- ArtWorkController.cs - Manages artworks
- CategoryController.cs - Manages categories
- OrderController.cs - Manages orders and invoices
- AuthHelper.cs - Helper methods for authentication and JWT generation
- Sets up dependency injection
- Configures JWT authentication
- Sets up database connection
- Configures CORS for Angular frontend
- Token-based authentication using JWT
- Role-based security (Admin vs Customer roles)
- RESTful API endpoints for artwork, user, and order management
- SQL Server database integration using Entity Framework Core
- Images stored as byte arrays in the database and served via endpoint
- Proper relationships between entities
- Invoice generation functionality
git clone OnlineArtGallery.API
cd OnlineArtGallery.API
Make sure SQL Server is installed and running.
Edit the connection string in appsettings.json:
{
"ConnectionStrings": {
"GalleryConnection": "Server=localhost;Database=OnlineArtGalleryDb;Trusted_Connection=True;TrustServerCertificate=True;"
}
}NOTE : - Change localhost to your server name (example:- SystemName\\SQLEXPRESS)
dotnet restore
If no migration exists:
dotnet ef migrations add InitialCreate
Then update the database:
dotnet ef database update
✅ The database and schema will be created.
dotnet run
Then open your browser and go to:
localhost:5052/swagger/index.html
Swagger will list all available endpoints.
.NET SDK
SQL Server
Any IDE like VS Code