From the route of Ibn ^Abbas, may Allah accept both of their deeds, from the Messenger of Allah, sallallahu ^alayhi wa sallam, who said, narrating from Allah :
<<Allah decreed the good and the bad deeds and made them known so the one who attempts to do a good deed and does not do it, Allah will have it recorded with Him as a complete good deed, and if he attempted to do it and did it , Allah will have it recorded with Him as ten good deeds up to seven hundred folds up to multitudes of folds.
If one attempts to commit a bad deed and does not do it, Allah will have it recorded with Him as a complete good deed, and if he attempts to commit it and does it, Allah will have it recorded with Him as one bad deed.>>
Narrated by al-Bukhari and Muslim in their books of as–Sahih in the aforementioned terminology.
An-Nawawi comments the following: “So observe my brother, may Allah guide us and you to goodness, the great generosity of Allah and think about the aforementioned terms. His saying << recorded with Him>> reflects His special care and His saying <<complete>> reflect corroboration and increased special care.
He said about committing the bad deed which if one attempts to commit it and does not do it: << Allah will have it recorded with Him as a complete good deed>>, so He corroborated it with the word <<complete>>, and if he does it << Allah will have it recorded with Him as one bad deed>> so He corroborated lessening it with <<one>> and did not corroborate it with <<complete>>.
I Praise Allah and express gratitude to Him who is clear from all non befitting attributes while I admit that we are unable to praise Him the Praise that is due to Him. Allah is the One who guides to good endings.”