ASP.NET: Elegant controller <-> service interaction
Hey! I am looking for an elegant controller <-> service interaction.
Example (pseudocode):
My issue with this code: The service layer is returning an HTTP status code although the car service shouldn't have to do anything with HTTP stuff.
I thought about adding a dedicated enum which would kinda imitate some of the HTTP status codes (OK, NotFound, Conflict).
Other ideas:
Thanks in advance!
Related:
Example (pseudocode):
My issue with this code: The service layer is returning an HTTP status code although the car service shouldn't have to do anything with HTTP stuff.
I thought about adding a dedicated enum which would kinda imitate some of the HTTP status codes (OK, NotFound, Conflict).
Other ideas:
- Throw custom exceptions (don't like this one, exceptions are ugly)
Thanks in advance!
Related: