I have an ASP.NET MVC site that processes, say, Cars, CarParts, and non-HTTP verbs. Like this sort of:
/Honda/Engine/Build
/Honda/Wheel/Move
/Honda/Door/Rotate
/Ford/Engine/Move
/Ford/Wheel/Rotate
/Ford/Door/Build
/Delorean/Engine/Rotate
/Delorean/Wheel/Build
/Delorean/Door/Move
And so on ...
Each car will handle their parts and verbs unlike the others -- no sharing of methods. My controllers may look like this:
public class HondaController : Controller
{
public ActionResult BuildEngine()
{ ... }
public ActionResult MoveEngine()
{ ... }
public ActionResult RotateEngine()
{ ... }
public ActionResult BuildWheel()
{ ... }
public ActionResult MoveWheel()
{ ... }
public ActionResult RotateWheel()
{ ... }
public ActionResult BuildDoor()
{ ... }
public ActionResult MoveDoor()
{ ... }
public ActionResult RotateDoor()
{ ... }
}
And then exactly the same for the FordController and the DeloreanController.
My question is this: How can I make a route that will combine the CarPart and Verb into an MVC action called "VerbCarPart"?
I can do it brute force by creating nine routes, but that breaks SRP. What is the elegant solution?