Пример #1
0
        public override async Task <OperationResult <string> > SendCodeAsync(string content, string to, CancellationToken cancellationToken)
        {
            SendNotification notif = new SendNotification();
            var smsSetting         = await unitOfWork.SettingRepository.Get <AddSMSSetting>(SettingEnum.SMSSetting.EnumToString(), cancellationToken);

            NotificationSms smsSend = new NotificationSms(notif);
            var             sendSms = await smsSend.Send(smsSetting.Result.LineNumber, smsSetting.Result.userApikey, to, content, smsSetting.Result.secretKey);

            if (sendSms.Success)
            {
                return(OperationResult <string> .BuildSuccessResult("Success Send SMS"));
            }
            return(OperationResult <string> .BuildFailure("Fail Send SMS"));
        }
Пример #2
0
        public override async Task <OperationResult <string> > SendCodeAsync(string content, string to, CancellationToken cancellationToken)
        {
            SendNotification notif = new SendNotification();
            var smsSetting         = await unitOfWork.SettingRepository.Get <AddSMSSetting>(SettingEnum.SMSSetting.EnumToString(), cancellationToken);

            var emailSetting = await unitOfWork.SettingRepository.Get <AddEmailSetting>(SettingEnum.EmailSetting.EnumToString(), cancellationToken);

            NotificationSms   smsSend   = new NotificationSms(notif);
            NotificationEmail emailSend = new NotificationEmail(smsSend);
            var sendSms = await smsSend.Send(smsSetting.Result.LineNumber, smsSetting.Result.userApikey, to, content, smsSetting.Result.secretKey);

            if (sendSms.Success)
            {
                // var sendEmail = await emailSend.Send(emailSetting.Result.From, "Email Confirm Code", content, emailSetting.Result.Username, emailSetting.Result.Password, to, emailSetting.Result.Port, emailSetting.Result.SmtpServer);
            }
            return(OperationResult <string> .BuildFailure("Fail Send SMS"));
        }