Beispiel #1
0
        /// <summary>
        /// Removes tags from the person
        /// </summary>
        /// <param name="crm">
        /// The <see cref="AgileCRM"/> instance.
        /// </param>
        /// <param name="tags">
        /// The tags to be removed
        /// </param>
        /// <returns>
        /// A <see cref="Task"/> representing the asynchronous operation.
        /// </returns>
        public async Task RemoveTagsAsync(AgileCRM crm, List <string> tags)
        {
            await this.PullAsync(crm).ConfigureAwait(false);

            var updateTagsRequest = new UpdateContactTagsRequest(this.Contact, tags);
            var response          = await crm.RequestAsync("contacts/delete/tags", HttpMethod.Put, JsonConvert.SerializeObject(updateTagsRequest)).ConfigureAwait(false);

            await this.PullAsync(crm).ConfigureAwait(false);
        }
Beispiel #2
0
        /// <summary>
        /// Adds tags to the person
        /// </summary>
        /// <param name="crm">
        /// The <see cref="AgileCRM"/> instance.
        /// </param>
        /// <param name="tags">
        /// The tags to be added
        /// </param>
        /// <returns>
        /// A <see cref="Task"/> representing the asynchronous operation.
        /// </returns>
        public async Task AddTagsAsync(AgileCRM crm, List <string> tags)
        {
            await this.PullAsync(crm).ConfigureAwait(false);

            var updateTagsRequest = new UpdateContactTagsRequest(this.Contact, tags);
            var response          = await crm.RequestAsync("contacts/edit/tags", HttpMethod.Put, JsonConvert.SerializeObject(updateTagsRequest)).ConfigureAwait(false);

            var updatedContact = JsonConvert.DeserializeObject <Contact>(response);

            this.Tags = updatedContact.Tags;
        }