Sounds like a failed thermostat. Easy fix.
Turn off the water heater power breaker (should be 30 amp double breaker for most).
Remove the cover panels for the upper and lower tstats and expose tstats.
Take a photo of or make a sketch of the exact layout and number of screws on each tstat (I always replace both at the same time...they're inexpensive.)
Go to a store and get two that look exactly like the old ones (doesn't have to be same brand.)
Next, remove ONE WIRE AT A TIME from the old tstats and connect it to the new in the exact same place. You cannot go wrong with this simple method. Tighten the screws securely. No fuss. No muss. No testing. Foolproof.
Should solve your problem.