A theoretical study of the reactions of with formaldehyde and with formamide is carried out. The viability of these gas-phase ion-molecule reactions as possible sources of formamide and acetamide under the conditions of interstellar medium is evaluated. We report a theoretical estimation of the reaction enthalpies and an analysis of their potential energy surfaces. Formation of protonated formamide from the reaction between ammonium cation and formaldehyde is an exothermic process, but all the channels located on the potential energy surface leading to this product present net activation energies. For the reaction between methanium and formamide, different products are possible from a thermodynamic point of view. An analysis of its potential energy surface showed that formation of protonated acetamide and amino acetaldehyde takes place through barrier-free paths. Therefore, this reaction could be a feasible source of acetamide and amino acetaldehyde in space.