Skip to content

Expert · Interviews, portfolio and careers · topic 41 of 43 · 40 min

Your portfolio project: a tested Web API with EF Core

Explanation

One complete, well-built project tells an employer more than ten half-finished tutorials. Build a small but real Web API, for example a clinic appointment system or a library manager, with ASP.NET Core, EF Core, validation, proper status codes, dependency injection, configuration without secrets, unit tests and a clear README, and put it on GitHub.

Why one strong project?

Recruiters see hundreds of CVs that list "C#, .NET, SQL". A link to a clean GitHub repository with a working API, tests and a good README proves you can actually build. In interviews it also gives you something concrete to talk about, which is easier and more convincing than abstract questions.

Pick a problem you understand

  • Clinic appointments: doctors, time slots, bookings, no double-booking (409 Conflict).
  • Library: books, members, issue and return, late fees.
  • Hostel mess: students, monthly bills, payments, dues report.
  • Small shop inventory: products, stock, sales, low-stock report.

Choose one with a few real rules (fees, limits, conflicts). Rules give you something meaningful to test and talk about.

Feature checklist

AreaWhat to include
API4 to 6 resources with GET/POST/PUT/DELETE, route groups, input DTOs
Validation and errors400 with clear messages, 404, 409 for conflicts, a global exception handler
DataEF Core with migrations, relationships, Include or projections, AsNoTracking for reads
DesignBusiness rules in services behind interfaces, registered with DI
ConfigConnection string in configuration; secrets in user-secrets; nothing secret in Git
TestsxUnit tests for the business rules (with fakes), ideally a few integration tests
DocsREADME with what it does, how to run it, example requests, and design decisions
Extras (optional)Authentication with JWT, pagination, logging, Docker, a CI workflow that runs dotnet test

A sensible structure

output
ClinicBooking/
  ClinicBooking.sln
  src/
    ClinicBooking.Api/          Program.cs, endpoints, DTOs
    ClinicBooking.Core/         entities, rules (BookingService), interfaces
    ClinicBooking.Data/         ClinicDb (DbContext), migrations
  tests/
    ClinicBooking.Tests/        rule tests with fakes
  README.md
  .gitignore
This is the multi-project layout from module 9. Keep it simple; three or four projects are plenty.

A rule worth testing

csharp
public class BookingService(IAppointmentStore store, TimeProvider time)
{
    public async Task<BookingResult> BookAsync(int doctorId, DateTime slot, string patient)
    {
        if (slot <= time.GetLocalNow().DateTime)
            return BookingResult.Fail("Slot is in the past");
        if (slot.Minute % 15 != 0)
            return BookingResult.Fail("Slots start every 15 minutes");
        if (await store.IsTakenAsync(doctorId, slot))
            return BookingResult.Conflict("Slot already booked");

        await store.AddAsync(doctorId, slot, patient);
        return BookingResult.Ok();
    }
}
The rules live in a service that depends on interfaces and TimeProvider, so every rule can be tested with fakes. The endpoint just maps the result to 201, 400 or 409.

Plan it in weeks

  1. Week 1: design the entities and endpoints on paper; create the solution; build the API with an in-memory list.
  2. Week 2: add EF Core with SQLite, migrations, relationships and validation.
  3. Week 3: move rules into services, write unit tests, add a global error handler.
  4. Week 4: polish: README, example .http requests, clean commits; optional JWT auth or Docker.

The README that gets read

  • One paragraph: what problem it solves and for whom.
  • Tech used: .NET version, ASP.NET Core, EF Core, xUnit.
  • How to run: clone, dotnet ef database update, dotnet run, and where to send requests.
  • Example requests and responses.
  • Design notes: why you chose the structure, what you would add next.
Careful: Before every push, check that no secrets are in the repository: no passwords, API keys or real connection strings in appsettings.json or code. Also check you are not committing bin/, obj/ or a local database file with personal data.

Common mistakes and fixes

  • Copying a tutorial project as-is: interviewers recognise them. Change the domain and add your own rules.
  • One giant commit at the end: commit in small steps with clear messages. It shows how you work.
  • No tests: even ten good unit tests set you apart from most fresher projects.
  • Overbuilding (microservices, five design patterns) before the basics work: finish a simple version first.

Need help?

Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.

Try:

Watch the lesson

Your portfolio project: a tested Web API with EF Core · 1/7

Portfolio project

In this lesson you will plan the one project that proves your .NET skills.

Prefer a video by a teacher? Find free videos on “ASP.NET Core web API project for portfolio EF Core xUnit beginner” on YouTube ↗

In real life: From a final-year project to a job offer

A B.Tech student in Nagpur turned her college "hostel complaint system" into a clean ASP.NET Core Web API with EF Core, a tested rule that escalates complaints older than 48 hours, and a README with example requests. In interviews she was asked mostly about her own design choices, which she could answer in depth.

csharp
public static class Escalation
{
    public static bool ShouldEscalate(DateTime raisedAt, DateTime now, bool resolved) =>
        !resolved && now - raisedAt > TimeSpan.FromHours(48);
}

public class EscalationTests   // in the xUnit test project
{
    [Theory]
    [InlineData(49, false, true)]
    [InlineData(47, false, false)]
    [InlineData(72, true, false)]
    public void ShouldEscalate_After48Hours(int hoursAgo, bool resolved, bool expected)
    {
        var now = new DateTime(2026, 7, 1, 12, 0, 0);
        Assert.Equal(expected, Escalation.ShouldEscalate(now.AddHours(-hoursAgo), now, resolved));
    }
}
A small, pure rule with a clear test is exactly the kind of code interviewers like to discuss.

Practice (0/3 done)

Task 1 · Question

Which project is most convincing to a .NET recruiter?

Task 2 · Question

Where should the database password for your project live during development?

Task 3 · Practice

Write a one-page plan for your portfolio project: the domain and users, 4 to 6 entities with their relationships, the endpoint list with methods and status codes, at least three business rules you will unit test, and a four-week schedule.

Quick quiz

Question 1

1.Why put business rules in a service behind interfaces?

Question 2

2.Which should NOT be committed to your project repository?

Question 3

3.What is the best first step for a portfolio project?

Read more (free)

Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.

Why put business rules in a service behind interfaces?

Answer: So the rules can be unit tested with fakes and reused

Testable, reusable rules are a sign of good design.

Which should NOT be committed to your project repository?

Answer: bin/ and obj/ folders and secrets

Build output and secrets stay out of Git.

What is the best first step for a portfolio project?

Answer: Get a simple version working end to end, then improve it

Finish a simple, working version first.

Where should database passwords for your project live?Related

Answer: In environment variables, never committed

Commit an example config without real secrets, if anything.

From Your portfolio project: a production-style Go API

Which set of things should every project README have?Related

Answer: A title, live link, screenshot, tech used and how to run it

These let a busy reader understand, see and try the project in a minute.

From Your portfolio project

How do you make a GitHub profile README?Related

Answer: Create a public repository with exactly the same name as your username and add README.md

GitHub shows the README.md of the repository named after your username at the top of your profile.

From Your portfolio and GitHub

Since which version does a new ASP.NET Core app start from Program.cs without Startup.cs?Related

Answer: .NET 6

The minimal hosting model arrived in .NET 6.

From ASP.NET Core: your first Web API

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

Next steps

  1. 2 more topics in “Interviews, portfolio and careers” before its exam: Career paths with C# and .NET in India, A 30-day revision plan for the whole course.
  2. Module 10 exam: Interviews, portfolio and careers · 10 questions · 15 min, without help. 4 topics of this module still to finish first.
  3. 43 topics left in the course before the final exam.

← Previous: The C# and .NET interview questions asked most often