From 73569a43644309d0342817580bcfd86c1face5b8 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 20 Dec 2022 12:27:47 +0300 Subject: Namespace refactoring --- src/AddIn/RhDatabaseClient.cs | 45 ------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/AddIn/RhDatabaseClient.cs (limited to 'src/AddIn/RhDatabaseClient.cs') diff --git a/src/AddIn/RhDatabaseClient.cs b/src/AddIn/RhDatabaseClient.cs deleted file mode 100644 index 3a2de5c..0000000 --- a/src/AddIn/RhDatabaseClient.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; - -namespace RhSolutions -{ - public static class RhDatabaseClient - { - private static HttpClient httpClient = AddIn.httpClient; - - public static async Task GetProduct(string line) - { - string request = @"https://rh.cebotari.ru/api/search?query=" + line; - - ServicePointManager.SecurityProtocol = - SecurityProtocolType.Tls12 | - SecurityProtocolType.Tls11 | - SecurityProtocolType.Tls; - - string response = await httpClient.GetStringAsync(request); - - var products = JsonConvert.DeserializeObject>(response); - - var product = products.FirstOrDefault(); - - if (product == null) - { - return null; - } - else - { - return $"{product.productSku} {product.name}"; - } - } - - private class DbProduct - { - public string productSku { get; set; } - public string name { get; set; } - } - } -} \ No newline at end of file -- cgit v1.2.3