Dave Tolls wrote:That last bit of your code (the bit where you are trying to find the pet and whether it is sold) should be a call to the method Carey showed.
Of course that new method ought to be in a service layer rather than in the controller, but small steps...
Hi Dave,
Someone just told me that I should check if the order is null before I do the checking on the petId,
So, is it ok if I just add a && condition to state petId is null and with the above, then I throw a ResponseStatusException?
I have also refactored the code to use a Service layer but my brain is not working cos when I started with this base line to check if the order is null, then I do not know what to return ?
Could you advise me ? tks.