Exemplo n.º 1
0
 /// <summary>
 /// Updates the specified MicrosoftStoreForBusinessApp using PATCH.
 /// </summary>
 /// <param name="microsoftStoreForBusinessAppToUpdate">The MicrosoftStoreForBusinessApp to update.</param>
 /// <returns>The updated MicrosoftStoreForBusinessApp.</returns>
 public System.Threading.Tasks.Task <MicrosoftStoreForBusinessApp> UpdateAsync(MicrosoftStoreForBusinessApp microsoftStoreForBusinessAppToUpdate)
 {
     return(this.UpdateAsync(microsoftStoreForBusinessAppToUpdate, CancellationToken.None));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="microsoftStoreForBusinessAppToInitialize">The <see cref="MicrosoftStoreForBusinessApp"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(MicrosoftStoreForBusinessApp microsoftStoreForBusinessAppToInitialize)
 {
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the specified MicrosoftStoreForBusinessApp using POST.
        /// </summary>
        /// <param name="microsoftStoreForBusinessAppToCreate">The MicrosoftStoreForBusinessApp to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created MicrosoftStoreForBusinessApp.</returns>
        public async System.Threading.Tasks.Task <MicrosoftStoreForBusinessApp> CreateAsync(MicrosoftStoreForBusinessApp microsoftStoreForBusinessAppToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <MicrosoftStoreForBusinessApp>(microsoftStoreForBusinessAppToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Updates the specified MicrosoftStoreForBusinessApp using PATCH.
        /// </summary>
        /// <param name="microsoftStoreForBusinessAppToUpdate">The MicrosoftStoreForBusinessApp 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 MicrosoftStoreForBusinessApp.</returns>
        public async System.Threading.Tasks.Task <MicrosoftStoreForBusinessApp> UpdateAsync(MicrosoftStoreForBusinessApp microsoftStoreForBusinessAppToUpdate, CancellationToken cancellationToken)
        {
            if (microsoftStoreForBusinessAppToUpdate.AdditionalData != null)
            {
                if (microsoftStoreForBusinessAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    microsoftStoreForBusinessAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, microsoftStoreForBusinessAppToUpdate.GetType().Name)
                    });
                }
            }
            if (microsoftStoreForBusinessAppToUpdate.AdditionalData != null)
            {
                if (microsoftStoreForBusinessAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    microsoftStoreForBusinessAppToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, microsoftStoreForBusinessAppToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <MicrosoftStoreForBusinessApp>(microsoftStoreForBusinessAppToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }