Thanks for your query Based on the facts that you have posted it appears that you are facing problems in getting hard erection( Secondary Ejaculation) after you had undergone surgery for Inguinal Hernia
First of all i would like to state that this is not related to the surgery at all.and it is mind related.
Following general measure will help you to boost up your confidence and getting good erection.
1) Practice regular exercise fior 45 minutes followed by meditation
for 1/2 an hour in the morning.
2) Take high protein diet rich in vegetables and fruits and vit A,C,D,E,Zinc..
3)Take anti oxidants like Almonds 5-6 everyday..
4) Avoid alcohol and smoking
You can take Phosphodiesterase Inhibitors like Sildenafil
1 hour before intercourse This will help you in getting hard erection Visit your family physician for dosage and to get prescription of the drug.
Do not worry things are bound to settle over a period of time.