RhDatabaseClient refactoring
This commit is contained in:
parent
755d556f09
commit
6ac7b98e59
@ -11,11 +11,9 @@ namespace RhSolutions.Services
|
|||||||
{
|
{
|
||||||
public static class RhDatabaseClient
|
public static class RhDatabaseClient
|
||||||
{
|
{
|
||||||
private static HttpClient httpClient = RhSolutionsAddIn.HttpClient;
|
|
||||||
|
|
||||||
public static async Task<object> GetProduct(string line)
|
public static async Task<object> GetProduct(string line)
|
||||||
{
|
{
|
||||||
string request = string.Empty;
|
string request;
|
||||||
|
|
||||||
if (Sku.TryParse(line, out var skus))
|
if (Sku.TryParse(line, out var skus))
|
||||||
{
|
{
|
||||||
@ -27,7 +25,7 @@ namespace RhSolutions.Services
|
|||||||
request = @"https://rh.cebotari.ru/api/search?query=" + line;
|
request = @"https://rh.cebotari.ru/api/search?query=" + line;
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = await httpClient.GetAsync(request);
|
var response = await RhSolutionsAddIn.HttpClient.GetAsync(request);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -49,7 +47,6 @@ namespace RhSolutions.Services
|
|||||||
{
|
{
|
||||||
return $"Ошибка сервера {response.StatusCode}";
|
return $"Ошибка сервера {response.StatusCode}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user