Capstone · C# and .NET
Capstone: a housing society maintenance API
The brief
Build the back end of a maintenance app for Green Park Society: a solution with a tested business-rules library, an ASP.NET Core minimal API with validation and proper status codes, monthly bills, payments and a dues report, data that survives a restart, and a release build. You test every endpoint with curl.
Why it matters
This is the shape of most real .NET back ends: rules in a class library with unit tests, a thin Web API on top, dependency injection, validation, correct HTTP status codes and a published build. A working, tested API like this in a GitHub repository, with a README showing curl calls, is exactly what interviewers for junior .NET and ASP.NET Core roles ask to see.
Skills you practise
- solutions and project references
- xUnit theories and test files
- records and LINQ
- thread-safe in-memory store with JSON files
- ASP.NET Core minimal APIs
- dependency injection (singleton)
- validation and status codes (400, 404, 409, 201)
- curl
- dotnet publish
You need
- .NET 8 SDK or newer (it includes ASP.NET Core)
- curl (built into Windows 10/11, macOS and Linux). In Windows PowerShell 5, type curl.exe, because plain curl there is a different command
- Two terminals: one runs the API, the other sends curl requests
- Git and a free GitHub account, for the portfolio repository
What you will have at the end
A GitHub repository with the Society solution: Society.Core (tested billing rules and a JSON-backed, thread-safe store), Society.Api (a minimal API with validation and correct status codes), Society.Tests (fifteen or more passing tests) and a README with curl examples.
How it is marked (rubric, 100 points)
| Working APIEvery endpoint answers as checked: 200 lists, 201 with Location, 400 with field errors, 404 and 409, correct bills and dues. | 30 |
|---|---|
| Tested rulesFifteen or more passing tests cover every rule edge (15/16 days, unknown vehicle, duplicates, restart, payments). | 25 |
| DesignRules live in Society.Core with no web code; the API only binds, validates and calls them; the store is a locked singleton. | 20 |
| Data and releaseData survives a restart; the release build runs in Production. | 10 |
| Portfolio qualityClear README with curl examples, a clean .gitignore, sensible commits, and you can explain every part. | 15 |
0/10 steps done
Step 1 of 10
Lay out the solution
The Society solution has Society.Core (class library), Society.Api (ASP.NET Core Empty) and Society.Tests (xUnit), with the right references, and it builds.
Make a Society folder and create the three projects in it. dotnet new web makes the "ASP.NET Core Empty" template: a minimal API with nothing extra. Both the API and the tests reference Society.Core, never the other way round, so the rules know nothing about the web. Copy Models.cs, BillCalculator.cs and SocietyStore.cs into Society.Core (delete Class1.cs), Program.cs into Society.Api, BillCalculatorTests.cs into Society.Tests (delete UnitTest1.cs), and the four .json files into a requests folder inside Society.
dotnet new sln -n Society
dotnet new classlib -o Society.Core
dotnet new web -o Society.Api
dotnet new xunit -o Society.Tests
dotnet sln add Society.Core Society.Api Society.Tests
dotnet add Society.Api reference Society.Core
dotnet add Society.Tests reference Society.Core
dotnet build$ mkdir Society
cd Society
dotnet new sln -n Society
dotnet new classlib -o Society.Core
dotnet new web -o Society.Api
dotnet new xunit -o Society.Tests
dotnet sln add Society.Core Society.Api Society.Tests
dotnet add Society.Api reference Society.Core
dotnet add Society.Tests reference Society.Core
(copy the project files in)
dotnet buildYour notes: Models.cs, BillCalculator.cs, SocietyStore.cs, Program.cs, BillCalculatorTests.cs, README.md
Write down each command you ran. It goes into your project summary.