public static string IdOf(this List <mailListObject> lists, string listName) { mailListObject list = lists.FirstOrDefault(x => x.name.Equals(listName, StringComparison.OrdinalIgnoreCase) || x.label.Equals(listName, StringComparison.OrdinalIgnoreCase)); if (list == null) { throw new ArgumentException("listName", string.Format("There is no mail list with the name or label {0}", listName)); } return(list.id); }
private async Task <BrontoResult> AddListAsync() { MailLists mailLists = new MailLists(Login); mailListObject list = new mailListObject() { name = "Test list " + DateTime.Now.ToString(), label = "Test list " + DateTime.Now.ToString() }; return(await mailLists.AddAsync(list)); }
private BrontoResult AddList(string name = null) { MailLists mailLists = new MailLists(Login); mailListObject list = new mailListObject() { name = "Test list " + DateTime.Now.ToString(), label = "Test list " + DateTime.Now.ToString() }; return(mailLists.Add(list)); }
/// <summary> /// Adds a list of contacts to a mailing list /// </summary> /// <param name="list">the list to add</param> /// <param name="contacts">the list of contacts to add</param> /// <returns>The result of the addToList operation <seealso cref="BrontoResult"/></returns> public BrontoResult AddToList(mailListObject list, contactObject[] contacts) { using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout)) { addToList addToList = new addToList() { list = list, contacts = contacts }; writeResult response = client.addToList(session.SessionHeader, addToList); return(BrontoResult.Create(response)); } }
public void UpdateListTest() { MailLists mailLists = new MailLists(Login); BrontoResult result = AddList(); Assert.IsFalse(result.HasErrors, "The list for update was not added"); mailListObject list = new mailListObject() { id = result.Items.First().Id, label = "Test list " + DateTime.Now.ToString() }; result = mailLists.Update(list); Assert.IsFalse(result.HasErrors, "The update returned errors"); Assert.IsFalse(result.Items.Any(x => x.IsNew), "the records was not updated"); }
public async Task UpdateAsyncTest() { MailLists mailLists = new MailLists(Login); BrontoResult result = await AddListAsync(); Assert.IsFalse(result.HasErrors); mailListObject list = new mailListObject() { id = result.Items.First().Id, label = "Test list " + DateTime.Now.ToString() }; result = await mailLists.UpdateAsync(list); Assert.IsFalse(result.HasErrors, "The update returned errors"); Assert.IsFalse(result.Items.Any(x => x.IsNew), "the records was not updated"); }
public async Task <BrontoResult> DeleteAsync(mailListObject mailList) { return(await DeleteAsync(new mailListObject[] { mailList })); }
public BrontoResult Delete(mailListObject mailList) { return(Delete(new mailListObject[] { mailList })); }
public BrontoResult Update(mailListObject mailList) { return(Update(new mailListObject[] { mailList })); }
public BrontoResult Add(mailListObject mailList) { return(Add(new mailListObject[] { mailList })); }