Exemple #1
0
        /// <summary>
        /// Delete contact methods of an existing participant of a specific safebox associated to the current user's account.
        /// </summary>
        /// <param name="participant">A Participant object</param>
        /// <param name="safebox">A Safebox object</param>
        /// <param name="contactMethodsIds">A list of contact method id</param>
        /// <param name="cancellationToken"></param>
        /// <returns>The updated Participant</returns>
        public async Task <Helpers.Participant> DeleteParticipantContactMethods(Helpers.Participant participant, Helpers.Safebox safebox, List <int?> contactMethodsIds, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (safebox.Guid == null)
            {
                throw new Exceptions.SendSecureException("Safebox Guid cannot be null");
            }

            if (participant.Id == null)
            {
                throw new Exceptions.SendSecureException("Participant id cannot be null");
            }

            string jsonResponse = await JsonClient.UpdateParticipantAsync(participant.UpdateFor <Helpers.Participant.Destruction>().OfFollowingContacts(contactMethodsIds).ToJson(), safebox.Guid, participant.Id, cancellationToken);

            participant.Update(jsonResponse);

            return(participant);
        }
Exemple #2
0
        /// <summary>
        /// Update an existing participant of a specific safebox associated to the current user's account.
        /// </summary>
        /// <param name="participant">A Participant object</param>
        /// <param name="safebox">A Safebox object</param>
        /// <param name="cancellationToken"></param>
        /// <returns>The updated Participant</returns>
        public async Task <Helpers.Participant> UpdateParticipantAsync(Helpers.Participant participant, Helpers.Safebox safebox, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (safebox.Guid == null)
            {
                throw new Exceptions.SendSecureException("Safebox Guid cannot be null");
            }

            if (participant.Id == null)
            {
                throw new Exceptions.SendSecureException("Participant Id cannot be null");
            }

            string jsonResponse = await JsonClient.UpdateParticipantAsync(participant.UpdateFor <Helpers.Participant.Edition>().ToJson(), safebox.Guid, participant.Id, cancellationToken);

            participant.Update(jsonResponse);

            return(participant);
        }