This repository contains a backend-focused technical challenge built with C# and .NET 8. It implements an order management system for a hamburger restaurant, including the required business and discount rules and an optional Blazor WebAssembly interface.
Build a Web API using ASP.NET Core 8 to manage orders for a hamburger restaurant.
- Three sandwich options:
- X Burger – $5.00
- X Egg – $4.50
- X Bacon – $7.00
- Extras:
- Fries – $2.00
- Soft Drink – $2.50
- Sandwich + Fries + Soft Drink → 20% discount
- Sandwich + Soft Drink → 15% discount
- Sandwich + Fries → 10% discount
Important constraint:
- Each order must contain at most one sandwich, one fries, and one soft drink.
- If duplicate items are sent, the API returns an error.
GET /api/products– List all sandwiches and extrasGET /api/products/sandwiches– List sandwiches onlyGET /api/products/extras– List extras onlyPOST /api/orders– Create an order (with discounts applied)GET /api/orders– List all ordersGET /api/orders/{id}– Get order by IDPUT /api/orders/{id}– Update an orderDELETE /api/orders/{id}– Delete an order
- No authentication required
- All data handled in-memory
- Requests tested via Swagger
GoodHamburgerAPI/
├── src/
│ ├── GoodHamburger.Api --> ASP.NET Core Web API
│ │ └── Dockerfile --> Docker build for API
│ ├── GoodHamburger.Web --> Blazor WebAssembly frontend
│ │ └── Dockerfile --> Docker build for Web frontend
│ ├── GoodHamburger.Domain --> Business models and enums
│ ├── GoodHamburger.DomainInterfaces --> Contracts (interfaces) for services
│ └── GoodHamburger.Infra --> In-memory implementation of services
├── tests/
│ └── GoodHamburger.Tests --> xUnit tests for business logic
├── docker-compose.yml --> Runs both API and Web together
└── .github/workflows/build-and-test.yml --> CI pipeline with GitHub Actions
- C#
- .NET 8
- ASP.NET Core Web API
- Blazor WebAssembly (bonus frontend)
- InMemory caching (IMemoryCache)
- xUnit (tests)
- Swagger / Swashbuckle
- Docker + Docker Compose
- GitHub Actions (CI)
git clone https://github.com/louresb/GoodHamburgerAPI.git
cd GoodHamburgerAPIdocker compose up --build- Swagger API Docs: http://localhost:8080/swagger
- Frontend (Blazor): http://localhost:5173/
Unit tests are written using xUnit and cover key business rules such as:
- Discount calculation
- Validation of item limits
- Duplicate item rejection
To run the tests:
cd tests/GoodHamburger.Tests
dotnet testAn optional frontend was created using Blazor WebAssembly to enhance the presentation and usability of the solution.
| Page | Description |
|---|---|
/place-order |
Submit a new order |
/orders |
View all orders |
/orders/edit/{id} |
Edit an existing order |
/orders/details/{id} |
View full order details |
The frontend communicates with the API using HttpClient through the API port exposed by Docker Compose.
- Clean layered architecture (API / Domain / Infra)
- Full CRUD for orders with business rules enforced
- API tested via Swagger and Postman
- Extra Blazor frontend to visualize the solution
- CI pipeline for the API, Blazor frontend and tests
- Fully Dockerized for local testing and presentation
- This repository is preserved as a concluded technical challenge and reflects its original requirements.
- The optional frontend extends the required API with a simple interface for exercising the order flow.