This commit is contained in:
vfedosevich 2015-04-15 05:23:08 -07:00
parent 599e9a8865
commit 84f9f63407
44 changed files with 560 additions and 92 deletions

View file

@ -2,8 +2,8 @@
{
public interface ISmsDistributionService
{
void SendMessage(string phoneFrom, string phone, string message);
bool SendMessage(string phoneFrom, string phone, string message);
void SendMessage(string phone, string message);
bool SendMessage(string phone, string message);
}
}

View file

@ -31,9 +31,9 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication
{
var response = GenerateResponse();
_smsService.SendMessage(WebDavAppConfigManager.Instance.TwilioParameters.PhoneFrom, phoneTo, response);
var result = _smsService.SendMessage(WebDavAppConfigManager.Instance.TwilioParameters.PhoneFrom, phoneTo, response);
return response;
return result ? response : string.Empty;
}
public string GenerateResponse()

View file

@ -6,7 +6,7 @@ namespace WebsitePanel.WebDav.Core.Services
{
public class TwillioSmsDistributionService : ISmsDistributionService
{
private TwilioRestClient _twilioRestClient { get; set; }
private readonly TwilioRestClient _twilioRestClient;
public TwillioSmsDistributionService()
{
@ -14,14 +14,18 @@ namespace WebsitePanel.WebDav.Core.Services
}
public void SendMessage(string phoneFrom, string phone, string message)
public bool SendMessage(string phoneFrom, string phone, string message)
{
_twilioRestClient.SendSmsMessage(phoneFrom, phone, message);
var result = _twilioRestClient.SendSmsMessage(phoneFrom, phone, message);
return string.IsNullOrEmpty(result.Status) == false;
}
public void SendMessage(string phone, string message)
public bool SendMessage(string phone, string message)
{
_twilioRestClient.SendSmsMessage(WebDavAppConfigManager.Instance.TwilioParameters.PhoneFrom, phone, message);
var result = _twilioRestClient.SendSmsMessage(WebDavAppConfigManager.Instance.TwilioParameters.PhoneFrom, phone, message);
return string.IsNullOrEmpty(result.Status) == false;
}
}
}