using Dapper;
using EnvelopeGenerator.Application.SQL;
using EnvelopeGenerator.Domain.Entities;
namespace EnvelopeGenerator.Application.Contracts.SQLExecutor;
///
///
///
public static class Extension
{
///
///
///
///
///
///
///
///
///
///
public static async Task CreateEnvelopeAsync(this ISQLExecutor executor, int userId, string title = "", string message = "", bool tfaEnabled = false, CancellationToken cancellation = default)
{
var parameters = new DynamicParameters();
parameters.Add("@UserId", userId);
parameters.Add("@Title", title);
parameters.Add("@TfaEnabled", tfaEnabled ? 1 : 0);
parameters.Add("@Message", message);
var envelopes = await executor.Execute(parameters, cancellation);
return envelopes.FirstOrDefault();
}
}