Browse Source

Add SmsSenderExtensions and add constructor to the SmsMessage class.

pull/594/head
Halil ibrahim Kalkan 8 years ago
parent
commit
4de7ca3fa0
  1. 19
      framework/src/Volo.Abp.Sms/Volo/Abp/Sms/SmsMessage.cs
  2. 14
      framework/src/Volo.Abp.Sms/Volo/Abp/Sms/SmsSenderExtensions.cs

19
framework/src/Volo.Abp.Sms/Volo/Abp/Sms/SmsMessage.cs

@ -1,15 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
using JetBrains.Annotations;
namespace Volo.Abp.Sms
{
public class SmsMessage
{
public string PhoneNumber { get; set; }
public string PhoneNumber { get; }
public string Text { get; set; }
public string Text { get; }
public IDictionary<string, object> Properties { get; set; }
public IDictionary<string, object> Properties { get; }
public SmsMessage([NotNull] string phoneNumber, [NotNull] string text)
{
PhoneNumber = Check.NotNullOrWhiteSpace(phoneNumber, nameof(phoneNumber));
Text = Check.NotNullOrWhiteSpace(text, nameof(text));
Properties = new Dictionary<string, object>();
}
}
}

14
framework/src/Volo.Abp.Sms/Volo/Abp/Sms/SmsSenderExtensions.cs

@ -0,0 +1,14 @@
using JetBrains.Annotations;
using System.Threading.Tasks;
namespace Volo.Abp.Sms
{
public static class SmsSenderExtensions
{
public static Task SendAsync([NotNull] this ISmsSender smsSender, [NotNull] string phoneNumber, [NotNull] string text)
{
Check.NotNull(smsSender, nameof(smsSender));
return smsSender.SendAsync(new SmsMessage(phoneNumber, text));
}
}
}
Loading…
Cancel
Save