diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2021-11-29 21:24:44 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2021-11-29 21:24:44 +0300 |
commit | 3ea18ae25e98527aa85835c9221ea01b36560b33 (patch) | |
tree | ca5ffb4f60b1c1b683e9094cec44d9431d3d1bb6 /Source/ExcelDNA/Functions.cs | |
parent | f3b6bfcd3e13519f648c3975d19b8f1d48130059 (diff) |
Add Uri Converter
Diffstat (limited to 'Source/ExcelDNA/Functions.cs')
-rw-r--r-- | Source/ExcelDNA/Functions.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/ExcelDNA/Functions.cs b/Source/ExcelDNA/Functions.cs new file mode 100644 index 0000000..a282e3e --- /dev/null +++ b/Source/ExcelDNA/Functions.cs @@ -0,0 +1,19 @@ +using AngleSharp.Dom; +using ExcelDna.Integration; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Rehau.Sku.Assist +{ + public class Functions + { + [ExcelFunction] + public static async Task<string> RAUNAME(string request) + { + Task<string> contentTask = Task.Run(() => SkuAssist.GetContent(request)); + Task<IDocument> documentTask = await contentTask.ContinueWith(content => SkuAssist.GetDocument(content)); + IProduct product = await documentTask.ContinueWith(doc => SkuAssist.GetProductFromDocument(doc.Result)); + return product != null ? product.ToString() : "Не найдено"; + } + } +}
\ No newline at end of file |