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); }
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); } }
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); }