public async Task<ProductModel> PublishDocumentAsync(ProductModel 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"); //create product using (var dclient = this.CreateClient()) { var client = dclient.Client; var content = this.GetContent(productInformation); var productReponse = await client.PostAsync(this.GetUri(ApiUrls.ProductUrl), content).ConfigureAwait(false); if (await this.HandleResponseAsync(productReponse).ConfigureAwait(false) == false) return null; var product = await this.GetObjectAsync<ProductModel>(productReponse.Content).ConfigureAwait(false); if (await this.uploadFilesAsync(product.Id, filesUri).ConfigureAwait(false) == false) return null; return product; } }
public Task<ProductModel> PublishDocumentAsync(ProductModel productInformation, IEnumerable<FileModel> files) { if (files == null || files.Any() == false) throw new ArgumentNullException("files", "You need to select file(s) to upload"); return this.publishDocumentAsync(productInformation, files); }