Пример #1
0
        /// <summary>
        /// Creates the specified TelecomExpenseManagementPartner using POST.
        /// </summary>
        /// <param name="telecomExpenseManagementPartnerToCreate">The TelecomExpenseManagementPartner to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created TelecomExpenseManagementPartner.</returns>
        public async System.Threading.Tasks.Task <TelecomExpenseManagementPartner> CreateAsync(TelecomExpenseManagementPartner telecomExpenseManagementPartnerToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <TelecomExpenseManagementPartner>(telecomExpenseManagementPartnerToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Пример #2
0
 /// <summary>
 /// Creates the specified TelecomExpenseManagementPartner using POST.
 /// </summary>
 /// <param name="telecomExpenseManagementPartnerToCreate">The TelecomExpenseManagementPartner to create.</param>
 /// <returns>The created TelecomExpenseManagementPartner.</returns>
 public System.Threading.Tasks.Task <TelecomExpenseManagementPartner> CreateAsync(TelecomExpenseManagementPartner telecomExpenseManagementPartnerToCreate)
 {
     return(this.CreateAsync(telecomExpenseManagementPartnerToCreate, CancellationToken.None));
 }
Пример #3
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="telecomExpenseManagementPartnerToInitialize">The <see cref="TelecomExpenseManagementPartner"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(TelecomExpenseManagementPartner telecomExpenseManagementPartnerToInitialize)
 {
 }
Пример #4
0
        /// <summary>
        /// Updates the specified TelecomExpenseManagementPartner using PATCH.
        /// </summary>
        /// <param name="telecomExpenseManagementPartnerToUpdate">The TelecomExpenseManagementPartner to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated TelecomExpenseManagementPartner.</returns>
        public async System.Threading.Tasks.Task <TelecomExpenseManagementPartner> UpdateAsync(TelecomExpenseManagementPartner telecomExpenseManagementPartnerToUpdate, CancellationToken cancellationToken)
        {
            if (telecomExpenseManagementPartnerToUpdate.AdditionalData != null)
            {
                if (telecomExpenseManagementPartnerToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    telecomExpenseManagementPartnerToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, telecomExpenseManagementPartnerToUpdate.GetType().Name)
                    });
                }
            }
            if (telecomExpenseManagementPartnerToUpdate.AdditionalData != null)
            {
                if (telecomExpenseManagementPartnerToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    telecomExpenseManagementPartnerToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, telecomExpenseManagementPartnerToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <TelecomExpenseManagementPartner>(telecomExpenseManagementPartnerToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified TelecomExpenseManagementPartner to the collection via POST.
 /// </summary>
 /// <param name="telecomExpenseManagementPartner">The TelecomExpenseManagementPartner to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created TelecomExpenseManagementPartner.</returns>
 public System.Threading.Tasks.Task <TelecomExpenseManagementPartner> AddAsync(TelecomExpenseManagementPartner telecomExpenseManagementPartner, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <TelecomExpenseManagementPartner>(telecomExpenseManagementPartner, cancellationToken));
 }
 /// <summary>
 /// Adds the specified TelecomExpenseManagementPartner to the collection via POST.
 /// </summary>
 /// <param name="telecomExpenseManagementPartner">The TelecomExpenseManagementPartner to add.</param>
 /// <returns>The created TelecomExpenseManagementPartner.</returns>
 public System.Threading.Tasks.Task <TelecomExpenseManagementPartner> AddAsync(TelecomExpenseManagementPartner telecomExpenseManagementPartner)
 {
     return(this.AddAsync(telecomExpenseManagementPartner, CancellationToken.None));
 }