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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
        /// <summary>
        /// Creates the specified TimeCard using POST.
        /// </summary>
        /// <param name="timeCardToCreate">The TimeCard to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created TimeCard.</returns>
        public async System.Threading.Tasks.Task <TimeCard> CreateAsync(TimeCard timeCardToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <TimeCard>(timeCardToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified TimeCard to the collection via POST.
 /// </summary>
 /// <param name="timeCard">The TimeCard to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created TimeCard.</returns>
 public System.Threading.Tasks.Task <TimeCard> AddAsync(TimeCard timeCard, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <TimeCard>(timeCard, cancellationToken));
 }
 /// <summary>
 /// Adds the specified TimeCard to the collection via POST.
 /// </summary>
 /// <param name="timeCard">The TimeCard to add.</param>
 /// <returns>The created TimeCard.</returns>
 public System.Threading.Tasks.Task <TimeCard> AddAsync(TimeCard timeCard)
 {
     return(this.AddAsync(timeCard, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified TimeCard using POST.
 /// </summary>
 /// <param name="timeCardToCreate">The TimeCard to create.</param>
 /// <returns>The created TimeCard.</returns>
 public System.Threading.Tasks.Task <TimeCard> CreateAsync(TimeCard timeCardToCreate)
 {
     return(this.CreateAsync(timeCardToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="timeCardToInitialize">The <see cref="TimeCard"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(TimeCard timeCardToInitialize)
 {
 }