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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified SalesInvoiceLine to the collection via POST.
 /// </summary>
 /// <param name="salesInvoiceLine">The SalesInvoiceLine to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SalesInvoiceLine.</returns>
 public System.Threading.Tasks.Task <SalesInvoiceLine> AddAsync(SalesInvoiceLine salesInvoiceLine, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <SalesInvoiceLine>(salesInvoiceLine, cancellationToken));
 }
 /// <summary>
 /// Adds the specified SalesInvoiceLine to the collection via POST.
 /// </summary>
 /// <param name="salesInvoiceLine">The SalesInvoiceLine to add.</param>
 /// <returns>The created SalesInvoiceLine.</returns>
 public System.Threading.Tasks.Task <SalesInvoiceLine> AddAsync(SalesInvoiceLine salesInvoiceLine)
 {
     return(this.AddAsync(salesInvoiceLine, CancellationToken.None));
 }
Пример #5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="salesInvoiceLineToInitialize">The <see cref="SalesInvoiceLine"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(SalesInvoiceLine salesInvoiceLineToInitialize)
 {
 }