示例#1
0
        public async Task<bool> UpdateDocumentAsync(int productId, ProductUpdateModel productInformation, IEnumerable<Uri> filesUri)
        {
            if (filesUri != null && filesUri.Any(c => c.IsValid() == false))
                throw new ArgumentException("Incorrect files uri, need the FileName, ContentType and Uri", "filesUri");
            var ok = await this.updateDocumentAsync(productId, productInformation).ConfigureAwait(false);
            if (ok == false)
                return false;

            if (filesUri != null)
                return await this.uploadFilesAsync(productId, filesUri).ConfigureAwait(false);

            return await this.finalizeUdateAsync(productId).ConfigureAwait(false);
        }
示例#2
0
        private async Task<bool> updateDocumentAsync(int productId, ProductUpdateModel productInformation)
        {
            //update the product
            using (var dclient = this.CreateClient())
            {
                var client = dclient.Client;
                var url = ApiUrls.ProductUpdateUrl.Replace("{id}", productId.ToString());
                var content = this.GetContent(productInformation);
                var response = await client.PutAsync(this.GetUri(url), content).ConfigureAwait(false);

                return await this.HandleResponseAsync(response).ConfigureAwait(false);
            }
        }
示例#3
0
 public async Task<bool> UpdateDocumentAsync(int productId, ProductUpdateModel productInformation)
 {
     var ok = await this.updateDocumentAsync(productId, productInformation).ConfigureAwait(false);
     if (ok == false)
         return false;
     return await this.finalizeUdateAsync(productId).ConfigureAwait(false);
 }