Run two methods but wait for only one

0

I need to run two methods

Metodo1();
Metodo2();

The first one should be executed normally after this I must return to the interface and leave in background the method 2 since it takes a little longer and does not return anything to the interface.

the first method does the following

      var dbcmd = database.GetStoredProcCommand("App_SpProgramarCita");
                database.AddInParameter(dbcmd, "IdCita", DbType.Int32, idCita);
                database.AddInParameter(dbcmd, "IdUsuario", DbType.Int32, idUsuario);
                database.ExecuteScalar(dbcmd);

and the second one sends an email, my idea was an asynchronous method but the executescalar does not have this kind of handling.

    
asked by SantiagoVictorinoC 08.09.2017 в 15:32
source

1 answer

2

Executing the Schedule method first and then in another thread you execute the method SendMailConfirmation() :

Schedule();
var task = Task.Factory.StartNew(()=>{
     SendMailConfirmation();
});
    
answered by 08.09.2017 / 15:50
source