Let's say I have an architecture Controller -> Service -> Repository etc Right now my code in the controller looks like this.
GetPlayers(){
if(playerService.verification1()) return NotFound ("message 1");
if(playerService.verification2()) return NotFound ("message 2");
if(playerService.verification3()) return BadRequest("bad request message");
if(playerService.verification4()) return Ok(players);
You get the idea. My controllers have some logic also. I want to have something like this in the controller methods "playerService.DoStuff(); Return Status code with Object (if any)"
What's the best way to do this? I know that the controllers should have very few lines.
Aucun commentaire:
Enregistrer un commentaire