HomeChallengesRepsProblemsLeaderboardTake a challenge

Vertical Slice Refactor

A 90-line God Method doing validation, data access and payment in one controller. Make it a slice.

Intermediate30 min on the clock5 graded checks · 100 pointsASP.NET Core RefactorPro
Graded by reading your code against the checklist below.

What you build

  • Drop the controller and the service/repository interfaces
  • Map the endpoint with a Minimal API instead
  • Take dependencies with a C# 12 primary constructor
  • Stamp the rows with ExecuteUpdateAsync rather than loading them
  • Return ProblemDetails on every failure, not a bare string

Done means

One self-contained slice, one round trip per update, and machine-readable failures.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. The feature lives in a slice, not a controller+15Where code lives
  2. The endpoint is mapped with a Minimal API+20Where code lives
  3. Dependencies arrive by primary constructor+20Modern C#
  4. Rows are updated without being loaded+25Querying a database
  5. Failures return ProblemDetails+20Failing in a shape callers can read

What it teaches

The rest of ASP.NET Core Refactor