public async Task SendAsync(Notification notification, INotificationRepo notificationRepo) { await TelegramBot._client.SendTextMessageAsync(notification.Receiver, notification.Content); var updateModel = new UpdateNotificationDto { NotificationId = notification.NotificationId, Status = NotificationStatus.Success, SendDateMi = DateTime.Now, SendStatus = "Success", IsLock = true }; await notificationRepo.UpdateAsync(updateModel); }
public async Task SendAsync(Notification notification, INotificationRepo notificationRepo) { var sendResult = await LinePayamakProvider.SendSmsAsync(notification.Receiver, notification.Content); var updateModel = new UpdateNotificationDto { NotificationId = notification.NotificationId, SendDateMi = DateTime.Now, SendStatus = sendResult }; if (sendResult.Split(':')[1] == "1") { updateModel.Status = NotificationStatus.Success; updateModel.IsLock = true; } else { updateModel.Status = NotificationStatus.Failed; updateModel.IsLock = false; } await notificationRepo.UpdateAsync(updateModel); }