Ejemplo n.º 1
0
        private static WebRequest SetUpWebRequest(BulkSMSModel bulkSmsModel)
        {
            var request = WebRequest.Create(bulkSmsModel.Url);

            request.Credentials =
                new NetworkCredential(bulkSmsModel.Username, bulkSmsModel.Password);
            request.PreAuthenticate = true;
            request.Method          = "POST";
            request.ContentType     = "application/json";
            return(request);
        }
Ejemplo n.º 2
0
        private BulkSMSModel GetSmsConfig()
        {
            var section = _config.GetSection(AppSettingsEnum.BulkSms.GetDescription());

            var smsConfigModel = new BulkSMSModel();

            foreach (var child in section.GetChildren())
            {
                if (child.Key.Equals("Username"))
                {
                    smsConfigModel.Username = child.Value;
                }
                if (child.Key.Equals("Password"))
                {
                    smsConfigModel.Password = child.Value;
                }
                if (child.Key.Equals("URI"))
                {
                    smsConfigModel.Url = child.Value;
                }
            }

            return(smsConfigModel);
        }