diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2021-11-29 16:36:04 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2021-11-29 16:36:04 +0300 |
commit | e9ec1df01b752b423b66cb30dc2025a396f769f5 (patch) | |
tree | 06c5c8ab66889c6e3dac0819280ef1b1bffcf3ac /Functions.cs | |
parent | 198e5c886f0e32b953e8a8bb25c087e035093604 (diff) |
Task chaining
Diffstat (limited to 'Functions.cs')
-rw-r--r-- | Functions.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Functions.cs b/Functions.cs index ab6cedf..9112822 100644 --- a/Functions.cs +++ b/Functions.cs @@ -1,4 +1,4 @@ -using System; +using AngleSharp.Dom; using ExcelDna.Integration; using System.Net.Http; using System.Threading.Tasks; @@ -12,7 +12,10 @@ namespace Rehau.Sku.Assist [ExcelFunction] public static async Task<string> RAUNAME(string request) { - throw new NotImplementedException(); + Task<string> contentTask = Task.Run(() => SkuAssist.GetContent(request, httpClient)); + Task<IDocument> documentTask = await contentTask.ContinueWith(content => SkuAssist.GetDocument(content)); + IProduct product = await documentTask.ContinueWith(doc => SkuAssist.GetProductFromDocument(doc.Result)); + return product.ToString(); } } }
\ No newline at end of file |