Your goal is to build a minimal Order Management API using C# and ASP.NET Core. For the sake of this interview, please skip setting up a real database; an in-memory data store (like a List, Dictionary, or ConcurrentDictionary) is perfect.
The Domain Model Your primary object is an Order. At a minimum, it should contain the following properties, but feel free to add anything else you think is necessary to make the endpoints work:
{
"Item": string,
"Qty": int,
"Price": decimal
}Required Endpoints Please implement the following RESTful endpoints:
- POST /order – Creates a new order.
- GET /order/{id} – Retrieves a specific order by its unique identifier.
- Bonus / Nice-to-Have (If time permits) 3. GET /orders – Retrieves a list of all current orders.
- Bonus / Nice-to-Have (If time permits) 4. Update orders
This is a pre-configured ASP.NET Core 10 Web API project. The boilerplate is done — you just need to implement the API.
What's already wired up:
- EF Core InMemory database provider (registered in
Program.csasAppDbContext) - Swagger UI at
/swaggerwhen running in Development mode - An
Ordermodel inModels/Order.cs - An empty
AppDbContextinData/AppDbContext.cs - An empty
OrdersControllerinControllers/OrdersController.cs
cd OrderApi
dotnet runThe API will start on http://localhost:5050. Open http://localhost:5050/swagger to explore your endpoints.
Build a simple Order Management API with the following endpoints:
Accepts an order in the following JSON format:
{
"item": "Widget",
"qty": 3,
"price": 9.99
}Stores the order and returns an appropriate response.
Retrieves a previously created order by its identifier.
An integration test suite is included. Run it to check your implementation:
dotnet testTime limit: 30 minutes. Focus on correctness and good API design practices.