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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified EducationOutcome to the collection via POST.
 /// </summary>
 /// <param name="educationOutcome">The EducationOutcome to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created EducationOutcome.</returns>
 public System.Threading.Tasks.Task <EducationOutcome> AddAsync(EducationOutcome educationOutcome, CancellationToken cancellationToken)
 {
     this.ContentType           = "application/json";
     this.Method                = "POST";
     educationOutcome.ODataType = string.Concat("#", StringHelper.ConvertTypeToLowerCamelCase(educationOutcome.GetType().FullName));
     return(this.SendAsync <EducationOutcome>(educationOutcome, cancellationToken));
 }
コード例 #3
0
        /// <summary>
        /// Creates the specified EducationOutcome using POST.
        /// </summary>
        /// <param name="educationOutcomeToCreate">The EducationOutcome to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created EducationOutcome.</returns>
        public async System.Threading.Tasks.Task <EducationOutcome> CreateAsync(EducationOutcome educationOutcomeToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <EducationOutcome>(educationOutcomeToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
コード例 #4
0
 /// <summary>
 /// Creates the specified EducationOutcome using POST.
 /// </summary>
 /// <param name="educationOutcomeToCreate">The EducationOutcome to create.</param>
 /// <returns>The created EducationOutcome.</returns>
 public System.Threading.Tasks.Task <EducationOutcome> CreateAsync(EducationOutcome educationOutcomeToCreate)
 {
     return(this.CreateAsync(educationOutcomeToCreate, CancellationToken.None));
 }
コード例 #5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="educationOutcomeToInitialize">The <see cref="EducationOutcome"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(EducationOutcome educationOutcomeToInitialize)
 {
 }
 /// <summary>
 /// Adds the specified EducationOutcome to the collection via POST.
 /// </summary>
 /// <param name="educationOutcome">The EducationOutcome to add.</param>
 /// <returns>The created EducationOutcome.</returns>
 public System.Threading.Tasks.Task <EducationOutcome> AddAsync(EducationOutcome educationOutcome)
 {
     return(this.AddAsync(educationOutcome, CancellationToken.None));
 }