A modern, multi-role e-commerce system built with ASP.NET Core 8 that enables customers to place orders, distributors to manage inventory and quotations, and employees to oversee the entire order lifecycle.
GadgetHub consists of four interconnected applications:
| Application | Purpose | Tech | Port |
|---|---|---|---|
| GadgetHub.API | REST API backend with JWT authentication, Entity Framework Core, business logic | ASP.NET Core Web API | 7151 |
| GadgetHub.CustomerPortal | Customer-facing portal for browsing products, placing orders | Razor Pages | 7193 |
| GadgetHub.DistributorPortal | B2B portal for inventory management and quotation handling | Razor Pages | 7160 |
| GadgetHub.EmployeeDashboard | Internal admin dashboard for product and order management | Razor Pages | 7263 |
All applications share a single SQL Server database managed through Entity Framework Core with Identity for authentication.
- Visual Studio 2022 (with ASP.NET and web development workload)
- .NET 8 SDK or later
- SQL Server LocalDB (included with Visual Studio) or SQL Server Express
- HTTPS enabled for local development
| Technology | Purpose |
|---|---|
| ASP.NET Core 8 | Web API framework |
| Entity Framework Core 9 | ORM for database operations |
| SQL Server | Relational database |
| ASP.NET Identity | User authentication and authorization |
| JWT (JSON Web Tokens) | API security and token-based authentication |
| C# 12 | Backend programming language |
| Technology | Purpose |
|---|---|
| Razor Pages | MVC-based server-side rendering |
| HTML5 | Markup |
| CSS3 | Styling |
| Bootstrap 5 | Responsive UI framework |
| JavaScript | Client-side interactivity |
| HttpClient | API communication |
| Tool | Purpose |
|---|---|
| Visual Studio 2022 | IDE |
| SQL Server Management Studio | Database management |
| Swagger/OpenAPI | API documentation |
| Entity Framework Core Migrations | Database versioning |
- Open SQL Server Object Explorer in Visual Studio or SQL Server Management Studio (SSMS)
- Connect to
(localdb)\mssqllocaldb - Execute the provided
GadgetHubDb.sqlscript in the solution root- This creates the database schema and inserts seed data (products, roles, users)
- Verify the database
GadgetHubDbappears in your instance
- Open
GadgetHub.Solution.slnin Visual Studio - Right-click Solution in Solution Explorer β Set Startup Projects...
- Select Multiple startup projects
- Set all four projects to Start:
- GadgetHub.API
- GadgetHub.CustomerPortal
- GadgetHub.DistributorPortal
- GadgetHub.EmployeeDashboard
- Click Apply β OK
- Press F5 to launch all applications simultaneously
Once running, open in your browser:
- Customer Portal: https://localhost:7193
- Distributor Portal: https://localhost:7160
- Employee Dashboard: https://localhost:7263
- API (Swagger): https://localhost:7151/swagger
Use these pre-seeded accounts to test different roles:
| Role | Username | Password |
|---|---|---|
| Admin (Employee) | testadmin |
Password123! |
| Distributor | TechWorld |
Password123! |
| Distributor | ElectroCom |
Password123! |
| Distributor | GadgetCentral |
Password123! |
| Customer | TestCustomer |
Password123! |
GadgetHub.Solution/
βββ GadgetHub.API/
β βββ Controllers/ β API endpoints (Auth, Products, Orders, etc.)
β βββ Models/ β Entity models (Product, Order, Distributor, etc.)
β βββ Data/ β DbContext and migrations
β βββ Services/ β Business logic (Quotations, etc.)
β βββ Dtos/ β Data transfer objects
β βββ appsettings.json β API configuration & JWT settings
βββ GadgetHub.CustomerPortal/
β βββ Pages/ β Razor Pages for customer UI
β βββ Services/ β HTTP client for API calls
β βββ Models/ β View models
βββ GadgetHub.DistributorPortal/
β βββ Pages/ β Razor Pages for distributor UI
β βββ Services/ β HTTP client for API calls
β βββ Models/ β View models
βββ GadgetHub.EmployeeDashboard/
β βββ Pages/ β Razor Pages for admin UI
β βββ Services/ β HTTP client for API calls
β βββ Models/ β View models
βββ GadgetHubDb.sql β Database schema and seed data
βββ GadgetHub.Solution.sln β Solution file
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register new customer or distributor |
| POST | /api/auth/login |
User authentication (returns JWT) |
| GET | /api/products |
Fetch all products with pagination |
| POST | /api/orders |
Create customer order |
| GET | /api/orders |
Retrieve user's orders |
| POST | /api/quotations |
Submit quotation request |
| GET | /api/quotations |
Fetch quotations |
| POST | /api/purchaseorders |
Create purchase order (distributor) |
Full API documentation available at /swagger when API is running.
Located in GadgetHub.API/appsettings.json:
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=GadgetHubDb;Trusted_Connection=True;MultipleActiveResultSets=true"Configure in GadgetHub.API/appsettings.json:
ValidAudience: Audience for JWT validationValidIssuer: Issuer of JWT tokensSecret: JWT signing key (change in production)
The API allows requests from portal applications:
- https://localhost:7193 (Customer Portal)
- https://localhost:7160 (Distributor Portal)
- https://localhost:7263 (Employee Dashboard)
| Issue | Solution |
|---|---|
| Cannot connect to database | Verify SQL Server is running; check connection string in appsettings.json |
| HTTPS certificate errors | This is normal for localhost dev environment; add exception in browser |
| CORS errors in console | Ensure API CORS is configured for your portal port numbers |
| GadgetHubDb.sql fails to execute | Verify you're connected to the correct SQL Server instance; modify file path if needed |
| Ports already in use | Change ports in launchSettings.json for each project |
| Multiple startup projects won't work | Ensure all projects are set to "Start" action, not "None" |
- Authentication: JWT tokens issued by API; stored in session cookies on portals
- Database: Migrations in
GadgetHub.API/Migrations/tracked in source control - Entity Framework: Using code-first approach; modify migrations if schema changes
- HTTPS: Required for JWT Bearer token validation; localhost certificates auto-generated by Visual Studio
- Session Timeout: 30 minutes on portal applications; configure in
Program.cs
- Multi-role authentication with ASP.NET Identity and JWT
- Order management from customer perspective
- Inventory tracking for distributors
- Quotation system for B2B operations
- Purchase orders for distributor stock fulfillment
- Role-based access control (Customer, Distributor, Employee)
- SQL Server database with Entity Framework Core migrations
Developed as a comprehensive C#/.NET enterprise software demonstration.