示例#1
0
        /// <summary>
        /// Update details of a Campaign.
        /// Updates the preferences of the target campaign.
        /// </summary>
        /// <returns></returns>
        public async Task <ResultBase> UpdateAsync(ParamCampaignUpdate param)
        {
            var arry = new Dictionary <string, string> {
                { nameof(param.CampaignID), param.CampaignID.ToString() }
            };

            arry.AddWithCondition(param.CampaignName.IsNotNullOrEmpty(), nameof(param.CampaignName), param.CampaignName);
            arry.AddWithCondition(param.FromName.IsNotNullOrEmpty(), nameof(param.FromName), param.FromName);
            arry.AddWithCondition(param.FromEmail.IsNotNullOrEmpty(), nameof(param.FromEmail), param.FromEmail);
            arry.AddWithCondition(param.ReplyToName.IsNotNullOrEmpty(), nameof(param.ReplyToName), param.ReplyToName);
            arry.AddWithCondition(param.ReplyToEmail.IsNotNullOrEmpty(), nameof(param.ReplyToEmail), param.ReplyToEmail);

            if (param.TargetSegmentIDs.IsNotNull() && param.TargetSegmentIDs.Length > 0)
            {
                for (int i = 0; i < param.TargetSegmentIDs.Length; i++)
                {
                    arry.AddWithCondition(param.TargetSegmentIDs[i].IsNotNullOrEmpty(), $"{nameof( param.TargetSegmentIDs )}[{i}]", param.TargetSegmentIDs[i]);
                }
            }

            if (param.TargetListIDs.IsNotNull() && param.TargetListIDs.Length > 0)
            {
                for (int i = 0; i < param.TargetListIDs.Length; i++)
                {
                    arry.AddWithCondition(param.TargetListIDs[i].IsNotNullOrEmpty(), $"{nameof( param.TargetListIDs )}[{i}]", param.TargetListIDs[i]);
                }
            }

            if (param.CustomerIDs.IsNotNull() && param.CustomerIDs.Length > 0)
            {
                for (int i = 0; i < param.CustomerIDs.Length; i++)
                {
                    arry.AddWithCondition(param.CustomerIDs[i].IsNotNullOrEmpty(), $"{nameof( param.CustomerIDs )}[{i}]", param.CustomerIDs[i]);
                }
            }

            return(await Http.Value.PostAsync <ResultBase>(SendloopAddress.CampaignUpdate, arry));
        }
示例#2
0
 /// <summary>
 /// Update details of a Campaign.
 /// Updates the preferences of the target campaign.
 /// </summary>
 /// <returns></returns>
 public ResultBase Update(ParamCampaignUpdate param)
 => UpdateAsync(param).GetAwaiter().GetResult();