Пример #1
0
    public static async Task CreateOrUpdateAsync(Dom.Account acc)
    {
        using var TN = DB.Transaction();

        if (acc.ID.HasValue()) // existing account
        {
            await TN.SavePreservingAsync(acc);
        }
        else // new account
        {
            await TN.SaveAsync(acc);
        }

        await TN.CommitAsync();
    }
Пример #2
0
    private async Task SendVerificationEmailAsync(Dom.Account a)
    {
        if (needsEmailVerification)
        {
            var code = PasswordGenerator.Generate(20);
            await Data.SetEmailValidationCodeAsync(code, a.ID);

            await new Notification
            {
                Type      = NotificationType.Account_Welcome,
                ToEmail   = a.Email,
                ToName    = $"{a.FirstName} {a.LastName}",
                SendEmail = true,
                ToMobile  = a.Mobile,
                SendSMS   = a.Mobile.HasValue()
            }
            .Merge("{Salutation}", $"{a.FirstName}")
            .Merge("{ValidationLink}", $"{BaseURL}#/account/{a.ID}-{code}/validate")
            .AddToSendingQueueAsync();
        }
    }